script.sh:语法错误:“(”意外的脚本返回退出代码 2

问题描述 投票:0回答:1

尝试在 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-08T02Z] /home//ace/pi-changes-for-tools-
integration@tmp/durabl
*/script.sh: 1: /home/j
*/***pi-changes-for-tools-
integration@tmp/durable-/script.sh:语法错误:“(”意外 脚本返回退出代码

尝试使用 sh 脚本进行修剪仍然给出相同的错误

谁能告诉我出了什么问题吗?

jenkins jenkins-pipeline jenkins-groovy semgrep
1个回答
0
投票

我不知道这个问题的答案,但我们的团队知道。您可以通过加入我们的 Slack 来获得更多支持:https://bit。 ly/ semgrepslack(删除空格) 或者在学院参加一些规则编写课程(这样你就可以自己修复它): https://academy.semgrep.dev

© www.soinside.com 2019 - 2024. All rights reserved.