Trying to set body parameter for post method in jenkins, build fails because of error unexpected "(" script returned with error status 2.
Following is the attached code stage in 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'
"""
}
It gives error as [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: Syntax error: "(" unexpected
script returned exit code
Tried trim along with sh script still gives same error
Can anybody tell what is wrong?