Skip to content

Commit

Permalink
detectExecuteScan - added parameter for diagnostic mode (#4937)
Browse files Browse the repository at this point in the history
* detectExecuteScan - added parameter for diagnostic mode

* changed-syntax

* added-custom-output-path

* amended-directory-creation
  • Loading branch information
dimaste authored May 28, 2024
1 parent ce34dd3 commit c4019cf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/detectExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,21 @@ func addDetectArgs(args []string, config detectExecuteScanOptions, utils detectU
args = append(args, fmt.Sprintf("--detect.tools=%v", strings.Join(config.DetectTools, ",")))
}

if config.EnableDiagnostics {
args = append(args, fmt.Sprintf("\"--detect.diagnostic=true\""))
args = append(args, fmt.Sprintf("\"--detect.cleanup=false\""))

err := utils.MkdirAll("./blackduckDiagnostics", 0o755)
if err != nil {
return nil, errors.Wrap(err, "failed to create diagnostics directory")
}

log.Entry().Info("Diagnostics enabled, output will be stored in ./blackduckDiagnostics")

args = append(args, fmt.Sprintf("\"--detect.scan.output.path=./blackduckDiagnostics\""))
args = append(args, fmt.Sprintf("\"--detect.output.path=./blackduckDiagnostics\""))
}

// to exclude dependency types for npm
if len(config.NpmDependencyTypesExcluded) > 0 && !checkIfArgumentIsInScanProperties(config, "detect.npm.dependency.types.excluded") {
args = append(args, fmt.Sprintf("--detect.npm.dependency.types.excluded=%v", strings.ToUpper(strings.Join(config.NpmDependencyTypesExcluded, ","))))
Expand Down
11 changes: 11 additions & 0 deletions cmd/detectExecuteScan_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions resources/metadata/detectExecuteScan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,15 @@ spec:
- STEPS
- STAGES
- PARAMETERS
- name: enableDiagnostics
type: bool
default: false
description:
"Parameter to enable diagnostics file generation by detect script"
scope:
- STEPS
- STAGES
- PARAMETERS
- name: generateReportsForEmptyProjects
type: bool
default: false
Expand Down

0 comments on commit c4019cf

Please sign in to comment.