从Jenkins声明性管道运行curl命令

vhmi4jdf  于 12个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(223)

我正在尝试从Jenkins宣告式管缐执行curl post命令,但是它掷回语法错误--预期的'}'找到':'
管道脚本如下所示:

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'
    
         }
      }
   }
}

字符串
请帮忙。

chhkpiq4

chhkpiq41#

试试这个

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"""

     }
  }
} }

字符串

相关问题