Skip to content

Commit

Permalink
feat(detect): Add support for Detect 10 (#5224)
Browse files Browse the repository at this point in the history
* Changes for detect 10 and repo change from synopsys to blackduck

* change for blakcduck

* Making detect 10 as default version

* changing test file

* Updated description for useDetect8 and useDetect9

* added udeDetect10 field

* Apply suggestions from code review

* commiting with go generate file

* Removing useDetect10 flag

---------

Co-authored-by: Vijayan T <[email protected]>
Co-authored-by: Christopher Fenner <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent 6dfccc5 commit 64ae652
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
6 changes: 4 additions & 2 deletions cmd/detectExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,11 @@ func getDetectScript(config detectExecuteScanOptions, utils detectUtils) error {

downloadScript := func() error {
if config.UseDetect8 {
return utils.DownloadFile("https://detect.synopsys.com/detect8.sh", "detect.sh", nil, nil)
return utils.DownloadFile("https://detect.blackduck.com/detect8.sh", "detect.sh", nil, nil)
} else if config.UseDetect9 {
return utils.DownloadFile("https://detect.blackduck.com/detect9.sh", "detect.sh", nil, nil)
}
return utils.DownloadFile("https://detect.synopsys.com/detect9.sh", "detect.sh", nil, nil)
return utils.DownloadFile("https://detect.blackduck.com/detect10.sh", "detect.sh", nil, nil)

}

Expand Down
13 changes: 12 additions & 1 deletion cmd/detectExecuteScan_generated.go

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

2 changes: 1 addition & 1 deletion cmd/detectExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func TestRunDetect(t *testing.T) {
utilsMock.AddFile("detect.sh", []byte(""))
err := runDetect(ctx, detectExecuteScanOptions{}, utilsMock, &detectExecuteScanInflux{})

assert.Equal(t, utilsMock.downloadedFiles["https://detect.synopsys.com/detect9.sh"], "detect.sh")
assert.Equal(t, utilsMock.downloadedFiles["https://detect.blackduck.com/detect10.sh"], "detect.sh")
assert.True(t, utilsMock.HasRemovedFile("detect.sh"))
assert.NoError(t, err)
assert.Equal(t, ".", utilsMock.Dir, "Wrong execution directory used")
Expand Down
2 changes: 1 addition & 1 deletion pkg/whitesource/configHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (c *ConfigOptions) addGeneralDefaults(config *ScanOptions, utils Utils, pro
{Name: "forceUpdate", Value: true, Force: true},
{Name: "offline", Value: false, Force: true},
{Name: "resolveAllDependencies", Value: false, Force: false},
{Name: "failErrorLevel", Value: "ALL", Force: true},
{Name: "failErrorLevel", Value: "ALL", Force: false},
{Name: "case.sensitive.glob", Value: false},
{Name: "followSymbolicLinks", Value: true},
}...)
Expand Down
13 changes: 12 additions & 1 deletion resources/metadata/detectExecuteScan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ spec:
param: container/repositoryPassword
- name: useDetect8
description:
"This flag enables the use of the supported version 8 of the Detect Script instead of v9"
"This flag enables the use of the supported version 8 of the Detect script instead of default version 10"
aliases:
- name: detect/useDetect8
type: bool
Expand All @@ -664,6 +664,17 @@ spec:
- STAGES
- STEPS
default: false
- name: useDetect9
description:
"This flag enables the use of the supported version 9 of the Detect script instead of default version 10"
aliases:
- name: detect/useDetect9
type: bool
scope:
- PARAMETERS
- STAGES
- STEPS
default: false
outputs:
resources:
- name: influx
Expand Down

0 comments on commit 64ae652

Please sign in to comment.