-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
stable/jenkins helm chart: 1.5.9
jenkins 2.176.2
kubernets-plugin 1.18.2
the slaves are: jenkins/jnlp-slave:3.27-1
Hi,
I have a declarative pipeline, where the pod contains a few containers, during the execution I want to specify where to run a particular step, so I use the container() step. When I declare an environment variable that contains '$' as value and try to use it in the container step the '$' is doubled.
I originally noticed this with the credential-binding plugin, but I figured that it can be reproduced with simply using environment variables.
I've created a simple pipeline to demonstrate:
pipeline { agent any environment { FRUIT = '$apple' } stages { stage("Test") { steps{ sh 'echo "${FRUIT}"' container('jnlp') { sh 'echo "${FRUIT}"' } } } } }
Result:
[Pipeline] stage [Pipeline] { (Test) [Pipeline] sh + echo $apple $apple [Pipeline] container [Pipeline] { [Pipeline] sh + echo $$apple $$apple