Issue
I am using a script in my jenkins file and one of the argument passed contains a space (--detect.project.user.groups="DATABASE RELEASE 1.0"):
sh './detect.sh --logging.level.com.synopsys.integration=DEBUG --blackduck.url="${URL}" --blackduck.api.token="${TOKEN}" --detect.project.version.name=${buildVersion} --detect.project.user.groups=\"DATABASE RELEASE 1.0\" --detect.project.name=${projectName} --detect.source.path="${artifact_dir}/"'
The same script when triggered through regular shell script worked fine and blackduck was able to pick up the user group with the space included but the same command run through jenkinsfile inside scripts with sh, here only DATABASE
gets picked up and the scan fails as it is not able to find the correct userGroup.
Let me know if there is any fix to this.
Thanks!
Solution
To have literal detect.sh --detect.project.name=\"Project Test\"
You have to escape each backslash with another one in groovy string
sh 'detect.sh --detect.project.name=\\"Project Test\\"'
Answered By - daggett
Answer Checked By - Mildred Charles (JavaFixing Admin)