Skip to content

Commit 8b24902

Browse files
Merge pull request #791 from bradmwilliams/retryable-jobs-fix
Retryable jobs not launching fix
2 parents 63677de + 2307b14 commit 8b24902

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

pkg/releasepayload/utils.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ func convertToVerificationStatusMapResult(job v1alpha1.JobStatus) (*releasecontr
4141
if state == releasecontroller.ReleaseVerificationStateSucceeded && url == "" {
4242
state = releasecontroller.ReleaseVerificationStatePending
4343
}
44+
// The ReleasePayload controller sets AggregateState=Pending for retryable jobs
45+
// that have failed but haven't exhausted their retries. The release-controller's
46+
// retry logic needs to see Failed (not Pending) to trigger a retry with backoff.
47+
// Detect this by checking whether all results are failures while aggregate is Pending.
48+
if state == releasecontroller.ReleaseVerificationStatePending && job.MaxRetries > 0 && len(job.JobRunResults) > 0 {
49+
allFailed := true
50+
for _, r := range job.JobRunResults {
51+
if r.State != v1alpha1.JobRunStateFailure && r.State != v1alpha1.JobRunStateAborted && r.State != v1alpha1.JobRunStateError {
52+
allFailed = false
53+
break
54+
}
55+
}
56+
if allFailed {
57+
state = releasecontroller.ReleaseVerificationStateFailed
58+
}
59+
}
4460
status := &releasecontroller.VerificationStatus{
4561
Retries: getVerificationStatusRetries(job),
4662
PreviousAttemptURLs: getVerificationStatusPreviousAttemptURLs(job.JobRunResults, url),

0 commit comments

Comments
 (0)