Re: not able to change string value in Jenkinsfile

2018-04-27 Thread Somshekar C Kadam
Hi Eric, Thanks for the feedback and clarifying between environment and groovy variable. I did use the experession yesterday itself and able to proceed onto next stage. Regards Somshekar C Kadam 9036660538 On Thu, Apr 26, 2018 at 7:43 PM, Eric Pyle wrote: > You are correctly getting the resu

Re: not able to change string value in Jenkinsfile

2018-04-26 Thread Eric Pyle
You are correctly getting the result value from file ${WORKSPACE}/result in the code below, and setting it into a Groovy variable called test_result. You must understand that this Groovy variable is completely separate from the environment variable test_result which you (uselessly) set in the a

Re: not able to change string value in Jenkinsfile

2018-04-26 Thread Somshekar C Kadam
Hi Slide, I am trying to set global variable test_result in test stage and then execute deploy stage using when directive. As test_result is not changing at all, deploy stage is being skipped, not sure why I have tried otuside shell also using script block {} File result is aviable in workspace, a

Re: not able to change string value in Jenkinsfile

2018-04-25 Thread Somshekar C Kadam
Ok let me check, thanks for the advice regards Somshekar Regards Somshekar C Kadam 9036660538 On Wed, Apr 25, 2018 at 5:06 PM, Slide wrote: > Yes, you can do that, you just can't set it from a shell script. > > On Wed, Apr 25, 2018, 00:20 Somshekar C Kadam > wrote: > >> Thanks Slide for the he

Re: not able to change string value in Jenkinsfile

2018-04-25 Thread Slide
Yes, you can do that, you just can't set it from a shell script. On Wed, Apr 25, 2018, 00:20 Somshekar C Kadam wrote: > Thanks Slide for the help, things are clear. > One more doubt I have, can we not set global variable which will set that > variable between different stages > > For ex consider

Re: not able to change string value in Jenkinsfile

2018-04-25 Thread Somshekar C Kadam
Thanks Slide for the help, things are clear. One more doubt I have, can we not set global variable which will set that variable between different stages For ex consider once Unit test is passed set variable pass = true same variable will be used in QA test stage to start if pass = true, start QA

Re: not able to change string value in Jenkinsfile

2018-04-20 Thread Slide
The other problem is that you are expecting state to be retained between invocations of sh. sh 'cd /media/usb' sh 'rm -rf testing' sh 'mkdir testing' sh 'cd testing' git branch: 'feature', url: 'g...@github.com: CelestialSystem/cyelp.git' sh 'cp develop-unit/arm/ltp.

Re: not able to change string value in Jenkinsfile

2018-04-20 Thread Somshekar C Kadam
Hi Slide, One more observation, this result file is not in workspace. that is the reason its always outputting 1 when we print the file content. This could be root cause in my understanding. I am sorry I should have mentioned this ealrier that verify script writes this file on hardisk which is not

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Somshekar C Kadam
Hi Slide, Sorry for the delay got some personal work had to step out. Here is the full script for test stage Here verify script writes to "result" file 0 on success and 1 on failure. I am checking on the machine its value is 0, but still when i compare value of output as mentioned by you it is ti

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Slide
Post your full script On Thu, Apr 19, 2018, 06:52 Somshekar C Kadam wrote: > Hi Slide, > > I meant always the result file has 0, using above readfile when I compare > in if cond it always says 1, I have even echoed tha value its shows 1, not > sure why > > regards > Somshekar > > Regards > Somsh

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Somshekar C Kadam
Hi Slide, I meant always the result file has 0, using above readfile when I compare in if cond it always says 1, I have even echoed tha value its shows 1, not sure why regards Somshekar Regards Somshekar C Kadam 9036660538 On Thu, Apr 19, 2018 at 7:21 PM, Somshekar C Kadam wrote: > Hi Slide,

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Somshekar C Kadam
Hi Slide, Thanks for the inputs. I did check the value of output its returning always 1, actually it has value 0. not sure why? one more clarification can we call awk in script { } block ? regards Somshekar Regards Somshekar C Kadam 9036660538 On Thu, Apr 19, 2018 at 7:12 PM, Slide wrote:

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Slide
Ok, then my suggestion is fine, after readFile, the variable output has the value, so just use an if check directly in the script block of the pipeline. script blocks are groovy scripts, so you can use most of the functionality of groovy to do what you want. On Thu, Apr 19, 2018 at 6:24 AM Somshek

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Somshekar C Kadam
Hi Slide, You got it right. result file contains either 0 or 1 as a unittest pass or fail. I need to read this file which contains 0 or 1 and proceed next stage. thanks in advance regards Somshekar Regards Somshekar C Kadam 9036660538 On Thu, Apr 19, 2018 at 6:52 PM, Slide wrote: > Well, it

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Slide
Well, it depends on what you are expecting to happen with these lines: awk '{ if ($1 == 0 ) { $res = "passed" } else $res = "fail" }' result awk '{ if ($1 == 0 ) { print "Success"; } else print "failure" }' result The shell scripts don't take parameters, so what are you expecting to be in $1? Wh

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Somshekar C Kadam
Hi Slide, First of thanks for the response. Ok understood Am not finding any documentation to do the same in jjenkinsfile. Please can you point to it or any example will help regards Somshekar Regards Somshekar C Kadam 9036660538 On Thu, Apr 19, 2018 at 6:39 PM, Slide wrote: > You can't set

Re: not able to change string value in Jenkinsfile

2018-04-19 Thread Slide
You can't set res inside a shell script and have it set in the pipeline. It seems like you are trying to use shell scripts to do things that could be done directly in the Jenkinsfile as well. Is there a reason you are using shell scripts for that? On Thu, Apr 19, 2018 at 1:41 AM Somshekar wrote:

not able to change string value in Jenkinsfile

2018-04-19 Thread Somshekar
Hi All, I am trying to change the value of string dependign upon the unittest cases passed by reading a file. For next stage to proceed I want to set the string depending upon the value next stage qa or other stage can proceed. but not able to change value f string in jenkins file. value of