运行 来自 Jenkins 声明式管道的 curl 命令
Running curl command from Jenkins declarative pipeline
我正在尝试从 Jenkins 声明性管道执行 curl post 命令,但是,它抛出语法错误 -- Expecting '}' found ':'
管道脚本如下:
管道{
代理{标签'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'
}
}
}
}
请帮忙。
试试这个
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"""
}
}
} }
我正在尝试从 Jenkins 声明性管道执行 curl post 命令,但是,它抛出语法错误 -- Expecting '}' found ':'
管道脚本如下:
管道{
代理{标签'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'
}
}
} }
请帮忙。
试试这个
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"""
}
}
} }