1
votes

I have a jenkins parameterized pipeline that is run with a groovy script. There are 3 jobs in this plugin

    JOB1  ----> JOB2 ----> JOB3

JOB1 takes 2 input parameters and generates a parameter "TEMP". I need to use this "TEMP" as input to JOB2 after making some minor changes to it. My pipeline script will make the changes before passing it to JOB2. I see that the JOB1 generates TEMP correctly and I have put it in a environment variable ("temp") in JOB1. How do i access the environment variable in my pipeline script? I tried

     echo "temp variable: " + env.TEMP
     echo "temp variable: " + ${TEMP}

but jenkins pipeline groovy does not recognize these values.

1
Have you tried using the params global variable?mkobit

1 Answers

2
votes

If the variable is set by the job and isn't a parameter in the build, as in a parameterized build try:

echo "temp variable: " + TEMP
echo "temp variable: " + "${TEMP}"