-
Bug
-
Resolution: Fixed
-
Minor
-
None
JENKINS-46278 added environment variables to the container step, allowing e.g. withEnv and withCredentials.
However, at least double quotes are not correctly escaped:
podTemplate(name: "horst", label: "label", containers: [ containerTemplate(name: 'debian', image: 'debian', ttyEnabled: true, command: 'cat', ) ]) { withEnv(['C="C', 'D=D"',]) { node("label") { container('debian') { sh '''echo "C='$C'" ''' sh '''echo "D='$D'" ''' } } } }
Leads to
[full] Running shell script + echo C='C export D=D' C='C export D=D' [Pipeline] sh [full] Running shell script + echo D='' D=''
In a perfect world, kubernetes would implement https://github.com/kubernetes/kubernetes/issues/50321, so no escaping would be needed.
For now, escaping double quotes in the environment variables will get us at least half the way.
- is related to
-
JENKINS-46278 Declarative Pipeline Environment ignored
- Resolved