diff --git a/cli/cmd/vulnerability.go b/cli/cmd/vulnerability.go index e4404116d..a46decd7e 100644 --- a/cli/cmd/vulnerability.go +++ b/cli/cmd/vulnerability.go @@ -260,6 +260,13 @@ func setDetailsFlag(cmds ...*flag.FlagSet) { func pollScanStatus(requestID string) error { cli.StartProgress(" Scan running...") + // @afiune bug: there are sometimes that the API returns the scan status as + // successful without any vulnerabilities, as if the assessment had none, but + // if you query it again, the assessment does have vulnerabilities. + // + // JIRA: RAIN-12964 + // Workaround: Retry the polling mechanism twice on success :( + bugRetry := true for { assessment, err, retry := checkScanStatus(requestID) if err != nil { @@ -267,6 +274,19 @@ func pollScanStatus(requestID string) error { } if retry { + cli.Log.Debugw("waiting for a retry", "request_id", requestID, "sleep", vulCmdState.PollInterval) + time.Sleep(vulCmdState.PollInterval) + continue + } + + // @afiune bug: there are sometimes that the API returns the scan status as + // successful without any vulnerabilities, as if the assessment had none, but + // if you query it again, the assessment does have vulnerabilities. + // + // JIRA: RAIN-12964 + // Workaround: Retry the polling mechanism twice on success :( + if bugRetry { + bugRetry = false time.Sleep(vulCmdState.PollInterval) continue }