Skip to content

Commit

Permalink
Fix api import
Browse files Browse the repository at this point in the history
  • Loading branch information
mgulter committed Dec 18, 2024
1 parent 196efc6 commit 0e52299
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions client/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ type ReleaseStatus struct {
CS PlaybookTypeDetail `json:"cs"`
IAC PlaybookTypeDetail `json:"iac"`
MAST PlaybookTypeDetail `json:"mast"`
INFRA PlaybookTypeDetail `json:"infra"`
}

const ReleaseStatusHistoryInprogress = "in_progress"
Expand Down
25 changes: 13 additions & 12 deletions client/scans.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ type (
}

ScanDetail struct {
ID string `json:"id"`
Name string `json:"name"`
Branch string `json:"branch"`
ScanType string `json:"scan_type"`
MetaData string `json:"meta_data"`
Tool string `json:"tool"`
ScannerType string `json:"scanner_type"`
Date *time.Time `json:"date"`
Project string `json:"project"`
Score int `json:"score"`
Summary Summary `json:"summary"`
Links struct {
ID string `json:"id"`
Name string `json:"name"`
Branch string `json:"branch"`
ScanType string `json:"scan_type"`
MetaData string `json:"meta_data"`
Tool string `json:"tool"`
ScannerType string `json:"scanner_type"`
Date *time.Time `json:"date"`
Project string `json:"project"`
Score int `json:"score"`
Summary Summary `json:"summary"`
InfraSourceProjectID string `json:"infra_source_project_id"`
Links struct {
HTML string `json:"html"`
} `json:"links"`
}
Expand Down
10 changes: 9 additions & 1 deletion cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,12 @@ func checkRelease(scan *client.ScanDetail, cmd *cobra.Command) error {
WaitDuration: time.Second * 5,
}

rs, err := c.ReleaseStatus(scan.Project, scan.Branch, releaseOpts)
var project = scan.Project
if scan.InfraSourceProjectID != "" {
project = scan.InfraSourceProjectID
}

rs, err := c.ReleaseStatus(project, scan.Branch, releaseOpts)
if err != nil {
return fmt.Errorf("failed to get release status: %w", err)
}
Expand Down Expand Up @@ -1366,6 +1371,9 @@ func isScanReleaseFailed(scan *client.ScanDetail, release *client.ReleaseStatus,
if release.MAST.Status == statusFail {
failedScans["MAST"] = scan.ID
}
if release.INFRA.Status == statusFail {
failedScans["INFRA"] = scan.ID
}

if breakByScannerType {
scannerType := strings.ToUpper(scan.ScannerType)
Expand Down

0 comments on commit 0e52299

Please sign in to comment.