How to use the environment variables set by a parameterized build?

601 views
Skip to first unread message

Martin Lichtin

unread,
Nov 16, 2012, 3:39:26 PM11/16/12
to jenkins...@googlegroups.com
Hi
For a parameterized build with one "run parameter" (let's name it X), Jenkins set three environment variables.

X
X.jobName
X.number

How can the latter two be used in a pre-step shell script?
Bash cannot handle environment variables containing a dot, it seems.

$ echo ${X.jobName}
bash: ${X.jobName}: bad substitution

r2_

unread,
Nov 17, 2012, 5:56:40 PM11/17/12
to jenkins...@googlegroups.com
Hey,


Short answer: 

echo ${JOB_NAME}
echo ${BUILD_NUMBER}

Martin Lichtin

unread,
Nov 23, 2012, 8:45:54 AM11/23/12
to jenkins...@googlegroups.com
I'm talking about a build job that is parameterized. The parameter is of type "run parameter".
Jenkins creates variables with names that cannot be used in a pre-step shell script. Quite annoying.
Reply all
Reply to author
Forward
0 new messages