I'm pretty new to groovy and jenkins pipelines. I'm trying to launch a python command line application from jenkins pipeline in shell command , but my build fails since one of the arguments uses pipe(|) symbol and pipeline interprets and adds single quotes to the command.
Below is my pipeline where I'm passing TAGS as jenkins build parameters where value is given as "test1|test2"
pipeline {
echo "${TAGS}"
stage('Shoot tests') {
stage('Shoot tests') {
echo "${TAGS}"
echo "-tags=\\\"${TAGS}\\\""
echo "-tags=\"${TAGS}\""
sh "python /orchestrator.py -server=${SERVER_URL} -tags=\"${TAGS}\" -output-dir=${output_base} || true"
}
}
Console prints as below:
[Pipeline] stage
[Pipeline] { (Shoot tests)
[Pipeline] echo
14:57:51 "test1|test2"
[Pipeline] echo
14:57:51 -tags=\""test1|test2"\"
[Pipeline] echo
14:57:51 -tags=""test1|test2""
[Pipeline] sh
14:57:51 + python /orchestrator.py -server=https://test.net '-tags="test1|test2"' -output-dir=outputs
Could you help me in how to avoid the single quote(' ') around the -tags argument ??
I want the command to be like this
python /orchestrator.py -server=https://test.net -tags="test1|test2" -output-dir=outputs
currently it's coming as
python /orchestrator.py -server=https://test.net '-tags="test1|test2"' -output-dir=outputs