首页 > 解决方案 > script.sh:语法错误:“(”意外脚本返回退出代码 2

问题描述

尝试在 jenkins 中为 post 方法设置 body 参数,构建失败,因为错误意外“(”脚本返回错误状态 2。

以下是 jenkins 中的附加代码阶段:

script{
    sh ("pip install semgrep")
    semgrep_result = sh(script:"semgrep --config=p/r2c-ci src --json", 
                        returnStdout:true).trim()

    echo "semgrep_res $semgrep_result"

    sh"""
      curl -X POST \
           -d "result":"$semgrep_result" \
           -d "discovery_source":"SAST" \
           -d "reponame":"v*****" \
           'https://dev************/get_scan_data'
      """
}

它给出的错误为 [2021-09-08T0 2Z] /home/ / ace/pi-changes-for-tools-
integration@tmp/durabl
*/script.sh: 1: /home/j
*/***pi- changes-for-tools-integration@tmp/durable-/script.sh
:语法错误:“(”意外脚本返回退出代码

尝试修剪连同 sh 脚本仍然给出相同的错误

任何人都可以告诉什么是错的?

标签: jenkinsjenkins-pipelinejenkins-groovysemgrep

解决方案


推荐阅读