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 <[email protected]> wrote: > 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 awk statement. > > script { > def file = "${WORKSPACE}/result" > def content = readFile(file) > echo "Value of content is $content" > if ( content == 0 ) test_result = 1 else test_result = 0 > } > > > So when you want to read that variable, you need to read a Groovy > variable, not an environment variable: > > environment name: 'test_result', value: '1' > > Here you are reading an environment variable "environment name: > 'test_result'..." > Instead you need to read your Groovy variable: > > expression {test_result == '1'} > > or even more directly: > > expression { return readFile('result') == '1' } > > -- > Eric Pyle > Siemens PLM Software > Lebanon, NH > [email protected]http://www.siemens.com/plm > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALbGK-riK4wGpFvF9a2ZwvubJhL-0pfbOwN7hrKLn6eSSR9zig%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
