0
votes

We have a build job that runs on a Jenkins slave node (Windows machine). The job uses environment variables defined in Windows on the slave.

Now, we had to change the values of some of the environment variables on the slave. When we call 'set' on the slave machine it shows the changed values correctly.

But when we start the build job on Jenkins and call 'set' there (Windows Batch Command) then the log still shows the old values of the environment variables! The same wrong values we see when we go to 'Jenkins' > 'Nodes' > '' > 'System Information'.

Do you know what causes the problem and how it can be fixed?

Thank you.

2

2 Answers

1
votes

Environment variables are propagated to child environments at the time of the child environment creation. If you changed the environment variables on the machine, only new processes spawned after that moment will have the new environment variables.

If you haven't restarted the Jenkins Slave process on that machine since changing the variables, then it won't be picked up.

1
votes

Well, starting Jenkins slave process didn't help. Sending slave in offline mode and then back to online didn't help, neither.

First as we started the master Jenkins process anew, the changes in envvars on the slave took effect and the master showed the proper envvar values. But starting the Jenkins app is not a proper solution...