@@ -29,6 +29,7 @@ type UploadCycloneDxCommand struct {
2929 filePrefix string
3030
3131 // Options
32+ printDeploymentView bool
3233 scanResultsRepository string
3334 projectKey string
3435}
@@ -75,6 +76,11 @@ func (ucc *UploadCycloneDxCommand) SetProjectKey(projectKey string) *UploadCyclo
7576 return ucc
7677}
7778
79+ func (ucc * UploadCycloneDxCommand ) SetPrintDeploymentView (printDeploymentView bool ) * UploadCycloneDxCommand {
80+ ucc .printDeploymentView = printDeploymentView
81+ return ucc
82+ }
83+
7884func (ucc * UploadCycloneDxCommand ) ServerDetails () (* config.ServerDetails , error ) {
7985 return ucc .serverDetails , nil
8086}
@@ -127,7 +133,7 @@ func (ucc *UploadCycloneDxCommand) Upload() (artifactPath string, err error) {
127133 return
128134 }
129135 // Upload the CycloneDx file to the JFrog repository
130- if artifactPath , err = createRepositoryIfNeededAndUploadFile (ucc .fileToUpload , ucc .serverDetails , ucc .scanResultsRepository , ucc .projectKey ); err != nil {
136+ if artifactPath , err = createRepositoryIfNeededAndUploadFile (ucc .fileToUpload , ucc .serverDetails , ucc .scanResultsRepository , ucc .projectKey , ucc . printDeploymentView ); err != nil {
131137 return "" , fmt .Errorf ("failed to upload file %s to repository %s: %w" , ucc .fileToUpload , ucc .scanResultsRepository , err )
132138 }
133139 return
@@ -157,7 +163,7 @@ func validateInputFile(cdxFilePath string) (err error) {
157163 return
158164}
159165
160- func createRepositoryIfNeededAndUploadFile (filePath string , serverDetails * config.ServerDetails , scanResultsRepository , relatedProjectKey string ) (artifactPath string , err error ) {
166+ func createRepositoryIfNeededAndUploadFile (filePath string , serverDetails * config.ServerDetails , scanResultsRepository , relatedProjectKey string , printDeploymentView bool ) (artifactPath string , err error ) {
161167 // scanResultsRepository may be the repository name and after the slash the path in the repository, we want to extract the repository name
162168 repoName := strings .Split (scanResultsRepository , "/" )[0 ]
163169 if repoName == "" {
@@ -176,7 +182,7 @@ func createRepositoryIfNeededAndUploadFile(filePath string, serverDetails *confi
176182 log .Debug (fmt .Sprintf ("Uploading scan results to %s" , scanResultsRepository ))
177183 // target repo is <repository name>/<repository path>, If the target path ends with a slash, the path is assumed to be a folder.
178184 // Else it is assumed to be a file. so we add a slash to the end of the repo to indicate that it is a folder.
179- uploaded , err := artifactory .UploadArtifactsByPattern (filePath , serverDetails , clientUtils .AddTrailingSlashIfNeeded (scanResultsRepository ), relatedProjectKey )
185+ uploaded , err := artifactory .UploadArtifactsByPattern (filePath , serverDetails , clientUtils .AddTrailingSlashIfNeeded (scanResultsRepository ), relatedProjectKey , printDeploymentView )
180186 if err != nil {
181187 return "" , fmt .Errorf ("failed to upload file %s to repository %s: %w" , filePath , scanResultsRepository , err )
182188 }
0 commit comments