Search code examples
jenkinsparameter-passingjenkins-pluginsjenkins-cli

Jenkins Pass custom variable to downstream jobs


I want to pass a custom variable from Job A to Job B. I have tried achieving this using the "Parameterized Trigger" plugin but I didnt work for me.

I am doing it the following way: On Job A:

execute shell --> export VAR=1
echo $VAR --> is returning 1

Trigger parameterized build on other projects: PARAM=${VAR}

On JobB: I have selected this project is parameterized and declared a variable as PARAM. But when I do execute shell --> echo ${PARAM} it returns be ${VAR} instead of 1.

Am I missing anything here ? Any pointers please ? Thanks in advance!!


Solution

  • I found a neat way to pass custom variables to downstream job here:

    https://sathishpk.wordpress.com/2016/03/01/how-to-passget-parameters-from-shell-command-into-jenkins-other-places/

    It worked for me!!