Skip to content

Commit

Permalink
detectExecuteScan - Removed option to change min-scan-interval for Si…
Browse files Browse the repository at this point in the history
…gnature Scan to enforce global interval value (#4875)

* removed option to change min-scan-interval to enforce global interval value

* returned-param-to-avoid-pipeline-breaks

* fix-for-tests
  • Loading branch information
dimaste authored Apr 15, 2024
1 parent 8241580 commit 94a3384
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
6 changes: 0 additions & 6 deletions cmd/detectExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,6 @@ func addDetectArgs(args []string, config detectExecuteScanOptions, utils detectU
args = append(args, fmt.Sprintf("--detect.excluded.directories=%s", strings.Join(config.ExcludedDirectories, ",")))
}

if config.MinScanInterval > 0 {
//Unmap doesnt work well with min-scan-interval and should be removed
config.Unmap = false
args = append(args, fmt.Sprintf("--detect.blackduck.signature.scanner.arguments='--min-scan-interval=%d'", config.MinScanInterval))
}

if config.Unmap {
if !piperutils.ContainsString(config.ScanProperties, "--detect.project.codelocation.unmap=true") {
args = append(args, "--detect.project.codelocation.unmap=true")
Expand Down
2 changes: 1 addition & 1 deletion cmd/detectExecuteScan_generated.go

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

8 changes: 0 additions & 8 deletions cmd/detectExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,9 @@ func TestAddDetectArgs(t *testing.T) {
VersioningModel: "major-minor",
CodeLocation: "",
ScanPaths: []string{"path1", "path2"},
MinScanInterval: 4,
},
expected: []string{
"--testProp1=1",
"--detect.blackduck.signature.scanner.arguments='--min-scan-interval=4'",
"--blackduck.url=https://server.url",
"--blackduck.api.token=apiToken",
"\"--detect.project.name=testName\"",
Expand All @@ -725,13 +723,11 @@ func TestAddDetectArgs(t *testing.T) {
VersioningModel: "major-minor",
CodeLocation: "",
ScanPaths: []string{"path1", "path2"},
MinScanInterval: 4,
CustomScanVersion: "1.0",
},
isPullRequest: true,
expected: []string{
"--testProp1=1",
"--detect.blackduck.signature.scanner.arguments='--min-scan-interval=4'",
"--blackduck.url=https://server.url",
"--blackduck.api.token=apiToken",
"\"--detect.project.name=Rapid_scan_on_PRs\"",
Expand Down Expand Up @@ -763,13 +759,11 @@ func TestAddDetectArgs(t *testing.T) {
"--detect.excluded.directories=dir1,dir2",
},
ExcludedDirectories: []string{"dir3,dir4"},
MinScanInterval: 4,
CustomScanVersion: "2.0",
},
isPullRequest: true,
expected: []string{
"--testProp1=1",
"--detect.blackduck.signature.scanner.arguments='--min-scan-interval=4'",
"--detect.detector.search.depth=5",
"--detect.detector.search.continue=false",
"--detect.excluded.directories=dir1,dir2",
Expand Down Expand Up @@ -802,13 +796,11 @@ func TestAddDetectArgs(t *testing.T) {
ScanProperties: []string{
"--detect.maven.build.command= --settings .pipeline/settings.xml -DskipTests install",
},
MinScanInterval: 4,
CustomScanVersion: "2.0",
},
isPullRequest: true,
expected: []string{
"--testProp1=1",
"--detect.blackduck.signature.scanner.arguments='--min-scan-interval=4'",
"--detect.maven.build.command=",
"--settings",
".pipeline/settings.xml",
Expand Down
4 changes: 3 additions & 1 deletion resources/metadata/detectExecuteScan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,17 @@ spec:
- PARAMETERS
- STAGES
- STEPS
## --- to remove minScanInterval from parameters list ---
- name: minScanInterval
description:
"This parameter controls the frequency (in number of hours) at which the signature scan is re-submitted for scan. When set to a
"[DEPRECATED] This parameter controls the frequency (in number of hours) at which the signature scan is re-submitted for scan. When set to a
value greater than 0, the signature scans are skipped until the specified number of hours has elapsed since the last signature scan."
type: int
scope:
- PARAMETERS
- STAGES
- STEPS
## -----------
- name: githubToken
description: "GitHub personal access token as per
https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line"
Expand Down

0 comments on commit 94a3384

Please sign in to comment.