Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in rerunning jobs #29955

Merged
merged 9 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix incorrect check
  • Loading branch information
Zettat123 committed Mar 20, 2024
commit 0fb3243273dd8b33d2fdc530a2ee7f52daa014c5
11 changes: 6 additions & 5 deletions routers/web/repo/actions/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ func Rerun(ctx *context_module.Context) {

if jobIndexStr == "" { // rerun all jobs
for _, j := range jobs {
if err := rerunJob(ctx, j, len(j.Needs) > 0); err != nil {
shouldBlock := len(j.Needs) > 0
if err := rerunJob(ctx, j, shouldBlock); err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
Expand All @@ -325,11 +326,11 @@ func Rerun(ctx *context_module.Context) {
continue
}
for _, need := range j.Needs {
if rerunJobsIDSet.Contains(need) && !rerunJobsIDSet.Contains(j.JobID) {
if rerunJobsIDSet.Contains(need) {
found = true
rerunJobs = append(rerunJobs, j)
rerunJobsIDSet.Add(j.JobID)
continue
break
}
}
}
Expand All @@ -339,8 +340,8 @@ func Rerun(ctx *context_module.Context) {
}

for _, j := range rerunJobs {
shouldlock := j.JobID != job.JobID && len(j.Needs) > 0
if err := rerunJob(ctx, j, shouldlock); err != nil {
shouldBlock := j.JobID != job.JobID && len(j.Needs) > 0
if err := rerunJob(ctx, j, shouldBlock); err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
Expand Down