-
Bug
-
Resolution: Fixed
-
Major
-
None
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.
To make sure to reproduce the issue, could you attach your job configuration file and your global infrastructure configuration file ($JENKINS_HOME/config.xml and $JENKINS_HOME/jobs/<job_name>/config.xml)?