I use the kubernetes plugin in a jenkins pipeline to run the stages in containers and I inject username password credentials as environment variables into the containers using the Credentials Binding Plugin. Some of the passwords have dollar sign in them and inside the container step those dollar signs somehow get doubled. I've narrowed down and it seems to be specific to environment variables(the credential bindings will define environment variables too), so I've created a simple pipeline testing this:
pipeline {
agent any
environment {
FRUIT = 'apple$'
}
stages {
stage('test') {
steps {
sh 'echo "${FRUIT}"'
container('jnlp') {
sh 'echo "${FRUIT}"'
}
}
}
}
}
The output:
apple$
apple$$
The second line is printed from the container step, same variable, but the dollar sign at the end is doubled.
Versions: - Jenkins 2.176.2 - Pipeline 2.6 - Kubernetes plugin 1.18.0
Does it suppose to work or is there some limitation with the container step?