Skip to content

Commit

Permalink
fix issues where versions are not set in details
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Dec 23, 2024
1 parent dc30b5c commit bfa7955
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions scanpullrequest/scanpullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func auditPullRequest(repoConfig *utils.Repository, client vcsclient.VcsClient)
repoConfig.Git.RepositoryCloneUrl = repositoryInfo.CloneInfo.HTTP

scanDetails := utils.NewScanDetails(client, &repoConfig.Server, &repoConfig.Git).
SetJfrogVersions(repoConfig.XrayVersion, repoConfig.XscVersion).
SetResultsContext(repositoryInfo.CloneInfo.HTTP, repoConfig.Watches, repoConfig.JFrogProjectKey, repoConfig.IncludeVulnerabilities, len(repoConfig.AllowedLicenses) > 0).
SetFixableOnly(repoConfig.FixableOnly).
SetFailOnInstallationErrors(*repoConfig.FailOnSecurityIssues).
Expand All @@ -144,8 +145,6 @@ func auditPullRequest(repoConfig *utils.Repository, client vcsclient.VcsClient)
if scanDetails, err = scanDetails.SetMinSeverity(repoConfig.MinSeverity); err != nil {
return
}
scanDetails.XrayVersion = repoConfig.XrayVersion
scanDetails.XscVersion = repoConfig.XscVersion

scanDetails.MultiScanId, scanDetails.StartTime = xsc.SendNewScanEvent(
scanDetails.XrayVersion,
Expand Down
3 changes: 1 addition & 2 deletions scanrepository/scanrepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (cfp *ScanRepositoryCmd) scanAndFixBranch(repository *utils.Repository) (er
func (cfp *ScanRepositoryCmd) setCommandPrerequisites(repository *utils.Repository, client vcsclient.VcsClient) (err error) {
// Set the scan details
cfp.scanDetails = utils.NewScanDetails(client, &repository.Server, &repository.Git).
SetJfrogVersions(cfp.XrayVersion, cfp.XscVersion).
SetFailOnInstallationErrors(*repository.FailOnSecurityIssues).
SetFixableOnly(repository.FixableOnly).
SetConfigProfile(repository.ConfigProfile).
Expand All @@ -136,8 +137,6 @@ func (cfp *ScanRepositoryCmd) setCommandPrerequisites(repository *utils.Reposito
return
}
cfp.scanDetails.SetResultsContext(repositoryInfo.CloneInfo.HTTP, repository.Watches, repository.JFrogProjectKey, repository.IncludeVulnerabilities, len(repository.AllowedLicenses) > 0)
cfp.scanDetails.XrayVersion = cfp.XrayVersion
cfp.scanDetails.XscVersion = cfp.XscVersion

if cfp.scanDetails, err = cfp.scanDetails.SetMinSeverity(repository.MinSeverity); err != nil {
return
Expand Down
6 changes: 6 additions & 0 deletions utils/scandetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ func NewScanDetails(client vcsclient.VcsClient, server *config.ServerDetails, gi
return &ScanDetails{client: client, ServerDetails: server, Git: git}
}

func (sc *ScanDetails) SetJfrogVersions(xrayVersion, xscVersion string) *ScanDetails {
sc.XrayVersion = xrayVersion
sc.XscVersion = xscVersion
return sc
}

func (sc *ScanDetails) SetDisableJas(disable bool) *ScanDetails {
sc.disableJas = disable
return sc
Expand Down

0 comments on commit bfa7955

Please sign in to comment.