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 <somkada...@gmail.com> wrote: > 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 res is not changing at all > > also to verify I have added one more script block belwo it to verify if > able to read file proerly and its value, its working fine. below its > printing failure as value is set to 1 in result file. > > not sure on this, please let me know possible solution thanks in advance > > ===================== > environment { > res = 'pass' > qapass = 'fail' > output = '-1' > } > > .... > .... > > script { > output = readFile 'result' > echo "Value of output is $output" > echo 'inside the script' > sh ''' > awk '{ if ($1 == 0 ) { $res = "passed" } > else $res = "fail" }' result > echo 'outside the script' > echo "value is $res" > ''' > } > script { > sh ''' > awk '{ if ($1 == 0 ) { print "Success"; } > else print "failure" }' result > echo 'outside the script' > ''' > } > > ========================== > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/8b5e5fd5-8e6f-486f-aa54-f5bc97aa1f03%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/8b5e5fd5-8e6f-486f-aa54-f5bc97aa1f03%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfvD%3DhiFmw2-RcTZhAV%3D0UAfX1VGMYdG%2B4%2BNyMq5rNp4Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.