diff --git a/cmd/detectExecuteScan.go b/cmd/detectExecuteScan.go index e0f6a68444..5fc5561a10 100644 --- a/cmd/detectExecuteScan.go +++ b/cmd/detectExecuteScan.go @@ -427,10 +427,11 @@ func getDetectScript(config detectExecuteScanOptions, utils detectUtils) error { log.Entry().Infof("Downloading Detect Script") downloadScript := func() error { - if config.UseDetect9 { - return utils.DownloadFile("https://detect.synopsys.com/detect9.sh", "detect.sh", nil, nil) + if config.UseDetect8 { + return utils.DownloadFile("https://detect.synopsys.com/detect8.sh", "detect.sh", nil, nil) } - return utils.DownloadFile("https://detect.synopsys.com/detect8.sh", "detect.sh", nil, nil) + return utils.DownloadFile("https://detect.synopsys.com/detect9.sh", "detect.sh", nil, nil) + } if err := downloadScript(); err != nil { diff --git a/cmd/detectExecuteScan_generated.go b/cmd/detectExecuteScan_generated.go index 2da821f465..bd771a332c 100644 --- a/cmd/detectExecuteScan_generated.go +++ b/cmd/detectExecuteScan_generated.go @@ -77,7 +77,7 @@ type detectExecuteScanOptions struct { RegistryURL string `json:"registryUrl,omitempty" validate:"required_if=ScanContainerDistro ubuntu ScanContainerDistro centos ScanContainerDistro alpine"` RepositoryUsername string `json:"repositoryUsername,omitempty" validate:"required_if=ScanContainerDistro ubuntu ScanContainerDistro centos ScanContainerDistro alpine"` RepositoryPassword string `json:"repositoryPassword,omitempty" validate:"required_if=ScanContainerDistro ubuntu ScanContainerDistro centos ScanContainerDistro alpine"` - UseDetect9 bool `json:"useDetect9,omitempty"` + UseDetect8 bool `json:"useDetect8,omitempty"` } type detectExecuteScanInflux struct { @@ -354,7 +354,7 @@ func addDetectExecuteScanFlags(cmd *cobra.Command, stepConfig *detectExecuteScan cmd.Flags().StringVar(&stepConfig.RegistryURL, "registryUrl", os.Getenv("PIPER_registryUrl"), "Used accessing for the images to be scanned (typically filled by CPE)") cmd.Flags().StringVar(&stepConfig.RepositoryUsername, "repositoryUsername", os.Getenv("PIPER_repositoryUsername"), "Used accessing for the images to be scanned (typically filled by CPE)") cmd.Flags().StringVar(&stepConfig.RepositoryPassword, "repositoryPassword", os.Getenv("PIPER_repositoryPassword"), "Used accessing for the images to be scanned (typically filled by CPE)") - cmd.Flags().BoolVar(&stepConfig.UseDetect9, "useDetect9", false, "This flag enables the use of the supported version 9 of the Detect Script instead of v8") + cmd.Flags().BoolVar(&stepConfig.UseDetect8, "useDetect8", false, "This flag enables the use of the supported version 8 of the Detect Script instead of v9") cmd.MarkFlagRequired("token") cmd.MarkFlagRequired("projectName") @@ -947,12 +947,12 @@ func detectExecuteScanMetadata() config.StepData { Default: os.Getenv("PIPER_repositoryPassword"), }, { - Name: "useDetect9", + Name: "useDetect8", ResourceRef: []config.ResourceReference{}, Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, Type: "bool", Mandatory: false, - Aliases: []config.Alias{{Name: "detect/useDetect9"}}, + Aliases: []config.Alias{{Name: "detect/useDetect8"}}, Default: false, }, }, diff --git a/cmd/detectExecuteScan_test.go b/cmd/detectExecuteScan_test.go index 7f02817729..8b4ac8d1f8 100644 --- a/cmd/detectExecuteScan_test.go +++ b/cmd/detectExecuteScan_test.go @@ -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/detect8.sh"], "detect.sh") + assert.Equal(t, utilsMock.downloadedFiles["https://detect.synopsys.com/detect9.sh"], "detect.sh") assert.True(t, utilsMock.HasRemovedFile("detect.sh")) assert.NoError(t, err) assert.Equal(t, ".", utilsMock.Dir, "Wrong execution directory used") diff --git a/resources/metadata/detectExecuteScan.yaml b/resources/metadata/detectExecuteScan.yaml index e098c32c40..138a1e5e19 100644 --- a/resources/metadata/detectExecuteScan.yaml +++ b/resources/metadata/detectExecuteScan.yaml @@ -653,11 +653,11 @@ spec: resourceRef: - name: commonPipelineEnvironment param: container/repositoryPassword - - name: useDetect9 + - name: useDetect8 description: - "This flag enables the use of the supported version 9 of the Detect Script instead of v8" + "This flag enables the use of the supported version 8 of the Detect Script instead of v9" aliases: - - name: detect/useDetect9 + - name: detect/useDetect8 type: bool scope: - PARAMETERS