However, if at Node level (http/s:///computer//configure), under Node Properties, you add Environment variables, those will be added to the container.
seems to be incorrect.
The link points to a line of code that calls
EnvVars envHost = computer.getEnvironment();
However, computer.getEnvironment() does not include the environment variables added via Node Properties.
This can be confirmed by creating a node named 'node-with-properties', and adding some environment variables via Node Properties, and running the following Jenkinsfile
node('node-with-properties') { docker.image('alpine').inside() { sh 'env' } }
You can then inspect the output of the env command, and notice that the environment variables from Node Properties are not available inside the docker container.
Comments
1 comment
This statement...
seems to be incorrect.
The link points to a line of code that calls
However, computer.getEnvironment() does not include the environment variables added via Node Properties.
This can be confirmed by creating a node named 'node-with-properties', and adding some environment variables via Node Properties, and running the following Jenkinsfile
You can then inspect the output of the env command, and notice that the environment variables from Node Properties are not available inside the docker container.
Please sign in to leave a comment.