While running the curl command using sh in Jenkins pipeline, the curl GET request after "&" is not getting sent.
pipeline{
agent{
node{
label 'xxxx'
}
}
stages{
stage('first'){
steps{
script{
def url = 'xxxxx/sonar/api/qualitygates'
def project = 'xxxx'
def pr = 'xxx'
sh "curl -u xxxx: ${url}/project_status?projectKey=${project}&branch=${pr}"
}
}
}
}
}
Somehow the "&" and anything after that is not read during command execution.
Console output in Jenkins
+ branch=xxxx
+ curl -u xxxx: 'xxxxxx/sonar/api/qualitygates/project_status?projectKey=xxxxx'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
for & in URL you should add \ for that like this: "curl URL/param1=value1¶m2=value2"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.