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/113cea5c-54f8-a468-ce56-9498728cced1%40cd-adapco.com.
For more options, visit https://groups.google.com/d/optout.