-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins 2.73.1 Kubernetes plugin 1.0
Pipeline parameters are not available as environment variables in the pod containers that aren't the JNLP container.
This Jenkinsfile produces output showing the issue:
properties([ parameters([ string(name: 'PARAM_TEST', defaultValue: 'foo', description: ''), ]), ]) podTemplate( cloud: 'kubernetes', containers: [ containerTemplate( alwaysPullImage: false, envVars: [], image: 'alpine', name: 'alpine', privileged: false, ttyEnabled: true, ), ], serviceAccount: 'jenkins', idleMinutes: 0, instanceCap: 2, label: 'test-pipeline', name: 'test-pipeline', ) { node ('test-pipeline') { sh 'echo \$PARAM_TEST: $PARAM_TEST' container('alpine') { sh 'echo \$PARAM_TEST: $PARAM_TEST' } } }
Output:
Started by user chance.zibolski [Pipeline] properties [Pipeline] podTemplate [Pipeline] { [Pipeline] node Running on test-pipeline-xchj7-gcv7h in /home/jenkins/workspace/test-pipeline [Pipeline] { [Pipeline] sh [test-pipeline] Running shell script + echo foo: foo foo: foo [Pipeline] container [Pipeline] { [Pipeline] sh [test-pipeline] Running shell script + echo : : [Pipeline] } [Pipeline] // container [Pipeline] } [Pipeline] // node [Pipeline] } [Pipeline] // podTemplate [Pipeline] End of Pipeline Finished: SUCCESS
- is caused by
-
JENKINS-49370 Environment variables cannot be set within the container step
- Resolved