Skip to content

Commit 182cdd3

Browse files
committed
Enhance job status aggregation logic
- Updated the condition for returning `StatusFailure` to ensure it only occurs when all jobs are done.
1 parent 29b2800 commit 182cdd3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

models/actions/run_job.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,12 @@ func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, col
168168
func AggregateJobStatus(jobs []*ActionRunJob) Status {
169169
allSuccessOrSkipped := len(jobs) != 0
170170
allSkipped := len(jobs) != 0
171+
allDone := len(jobs) != 0
171172
var hasFailure, hasCancelled, hasWaiting, hasRunning, hasBlocked bool
172173
for _, job := range jobs {
173174
allSuccessOrSkipped = allSuccessOrSkipped && (job.Status == StatusSuccess || job.Status == StatusSkipped)
174175
allSkipped = allSkipped && job.Status == StatusSkipped
176+
allDone = allDone && job.Status.IsDone()
175177
hasFailure = hasFailure || job.Status == StatusFailure
176178
hasCancelled = hasCancelled || job.Status == StatusCancelled
177179
hasWaiting = hasWaiting || job.Status == StatusWaiting
@@ -185,7 +187,7 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status {
185187
return StatusSuccess
186188
case hasCancelled:
187189
return StatusCancelled
188-
case hasFailure:
190+
case hasFailure && allDone:
189191
return StatusFailure
190192
case hasRunning:
191193
return StatusRunning

0 commit comments

Comments
 (0)