Josh Davidson created JENKINS-13085:
---------------------------------------
Summary: Environment Variable Injection doesn't work when project
Key: JENKINS-13085
URL: https://issues.jenkins-ci.org/browse/JENKINS-13085
Project: Jenkins
Issue Type: Bug
Components: envinject
Affects Versions: current
Reporter: Josh Davidson
Assignee: gbois
When a slave node is configured to append/prepend to a variable (Node
Properties->Environment Variables) that is used by EnvInject within a job, the
injection fails. If the slave node simply sets the variable (i.e. doesn't
reference the same variable in the act of setting) it works fine. Consider the
following job, which has a single build step: echo $PATH
In Build Environment->Inject, there is a single line in the properties content
box: PATH=/opt/bin:$PATH
That's the job. Now, the slave node, also sets the PATH variable. Let's first
look at a working example, where the slave node sets PATH to:
/data/goesrsw/goesr/bin Here is the output:
[EnvInject] - Executing scripts and injecting environment variables after the
SCM step.
[EnvInject] - Injecting as environment variables the properties content
PATH=/opt/bin:$PATH
[EnvInject] - Variables injected successfully.
[aaa] $ bash -xe /tmp/hudson5838824311735104563.sh
+ echo /opt/bin:/data/goesrsw/goesr/bin
/opt/bin:/data/goesrsw/goesr/bin
Notifying upstream projects of job completion
Finished: SUCCESS
Ok, so to demonstrate the problem, change the PATH in the slave node to:
/data/goesrsw/goesr/bin:$PATH
Now, here's the output:
[EnvInject] - Executing scripts and injecting environment variables after the
SCM step.
[EnvInject] - Injecting as environment variables the properties content
PATH=/opt/bin:$PATH
[EnvInject] - Variables injected successfully.
[EnvInject] - Unset unresolved 'PATH' variable.
[aaa] $ bash -xe /tmp/hudson3276485997068093627.sh
+ echo
/data/goesrsw/goesr/bin:/data/goesrsw/goesr/bin:/data/goesrsw/goesr/bin:/home/goesrjen/bin:/usr/local/bin:/usr/local/sbin:/app/share/bin:/app/share/sbin:/usr/bin/X11:/bin:/usr/bin:/sbin:/usr/sbin:.:/app/rc52_test1_perl:/data/goesrsw/WindRiver/gnu/4.1.2-vxworks-6.6/x86-linux2/bin:/data/goesrsw/WindRiver/workbench-3.0/x86-linux2/bin:/data/goesrsw/WindRiver/workbench-3.0/foundation/4.1.1/x86-linux2/lib/tcl8.4/Wind
/data/goesrsw/goesr/bin:/data/goesrsw/goesr/bin:/data/goesrsw/goesr/bin:/home/goesrjen/bin:/usr/local/bin:/usr/local/sbin:/app/share/bin:/app/share/sbin:/usr/bin/X11:/bin:/usr/bin:/sbin:/usr/sbin:.:/app/rc52_test1_perl:/data/goesrsw/WindRiver/gnu/4.1.2-vxworks-6.6/x86-linux2/bin:/data/goesrsw/WindRiver/workbench-3.0/x86-linux2/bin:/data/goesrsw/WindRiver/workbench-3.0/foundation/4.1.1/x86-linux2/lib/tcl8.4/Wind
Notifying upstream projects of job completion
Finished: SUCCESS
As you can see, the injection didn't work. /opt/bin is nowhere to be found.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira