我正在尝试从Jenkins声明性管道执行curl post命令,但是,它引发了语法错误-期望'}'找到了':'
管道脚本如下:
管道{
代理{标签'Linux01'}
阶段{
stage('Hello') {
steps {
sh 'curl -u username:password -X POST -d '{"body":"Jenkinspipleinecomment"}' -H "Content-Type:application/json" http://localhost:8080/rest/api/2/issue/someissue/comment'
}
}
} }
请帮助。
答案 0 :(得分:0)
尝试一下
pipeline {
agent { label ' Linux01'}
stages {
stage('Hello') {
steps {
sh """curl -u username:password -X POST -d '{"body":"Jenkinspipleinecomment"}' -H "Content-Type:application/json" http://localhost:8080/rest/api/2/issue/someissue/comment"""
}
}
} }