Skip to content

Commit

Permalink
Mend fix for the config path calculation (#4766)
Browse files Browse the repository at this point in the history
* fix-for-the-scan-path-in-custom-pipelines

* amended-scan-path-logic

* minor-changes

* returned-old-way-of handling-config

* returned-old-way

* removed-comments
  • Loading branch information
dimaste authored Jan 15, 2024
1 parent 6ac8fd1 commit 86a59eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/whitesourceExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ func downloadDockerImageAsTar(config *ScanOptions, utils whitesourceUtils) error
ContainerRegistryUser: config.ContainerRegistryUser,
ContainerRegistryPassword: config.ContainerRegistryPassword,
DockerConfigJSON: config.DockerConfigJSON,
FilePath: config.ProjectName, // previously was config.ProjectName
FilePath: config.ProjectName, // consider changing this to config.ScanPath + "/" + config.ProjectName
ImageFormat: "legacy", // keep the image format legacy or whitesource is not able to read layers
}
dClientOptions := piperDocker.ClientOptions{ImageName: saveImageOptions.ContainerImage, RegistryURL: saveImageOptions.ContainerRegistryURL, LocalPath: "", ImageFormat: "legacy"}
Expand Down
10 changes: 3 additions & 7 deletions pkg/whitesource/configHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type ConfigOption struct {
Append bool
}

const configFileName = "wss-unified-agent.config"

// ConfigOptions contains a list of config options (ConfigOption)
type ConfigOptions []ConfigOption

Expand All @@ -47,13 +49,7 @@ func (s *ScanOptions) RewriteUAConfigurationFile(utils Utils, projectName string

now := time.Now().Format("20060102150405")

var newConfigFilePath string

if s.ScanPath != "." {
newConfigFilePath = fmt.Sprintf("%v/%v.%v", s.ScanPath, s.ConfigFilePath, now)
} else {
newConfigFilePath = fmt.Sprintf("%v.%v", s.ConfigFilePath, now)
}
newConfigFilePath := fmt.Sprintf("%v.%v", s.ConfigFilePath, now)

var configContent bytes.Buffer
_, err = newConfig.Write(&configContent, properties.UTF8)
Expand Down

0 comments on commit 86a59eb

Please sign in to comment.