Skip to content

Additional arguments are duplicated in the "scan create" command line #156

@lasselindqvist

Description

@lasselindqvist

When command line is constructed, the Jenkins plugin at least calls
https://github.com/jenkinsci/checkmarx-ast-scanner-plugin/blob/b0fa8477f9adb523e0089ca1a859fd5c813bded5/src/main/java/com/checkmarx/jenkins/PluginUtils.java#L50

The wrapper creates the command line command with

        List<String> arguments = buildScanCreateArguments(params, additionalParameters);

        return Execution.executeCommand(arguments, logger, Scan::fromLine);

which in turn does
return withConfigArguments(buildScanCreateArgumentsArray(params, additionalParameters));

I think the problem is that buildScanCreateArgumentsArray already adds the additional parameters to the list and then withConfigArguments adds those to the command correctly, but also readds them in the end of the method with
arguments.addAll(this.cxConfig.toArguments());

Example console output from a Jenkins build:

13:35:34  [Cx-Info]: Branch name: ${GIT_BRANCH}
13:35:34  [Cx-Info]: Using global additional options: false
13:35:34  [Cx-Info]: Additional Options: --sast-incremental
13:35:34  [Cx-Info]: Checkmarx installation is UP-TO-DATE
13:35:34  [Cx-Info]: Submitting the scan details to the CLI wrapper.
13:35:34  [Cx-Info]: Executable path: /home/lasse/build/tools/com.checkmarx.jenkins.tools.CheckmarxInstallation/Checkmarx/cx 
13:35:34  $ /home/lasse/build/tools/com.checkmarx.jenkins.tools.CheckmarxInstallation/Checkmarx/cx scan create --scan-info-format json -s /home/lasse/build/workspace/Checkmarx_desktop-main_PR-1234 --agent Jenkins --project-name MyProject --branch PR-1234 --sast-incremental --tenant myTenant --base-uri https://eu.ast.checkmarx.net --sast-incremental

Notice the duplicated --sast-incremental

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions