mirror of
https://github.com/go-gitea/gitea
synced 2024-11-06 14:19:03 +01:00
Not trigger all jobs any more, when re-running the first job (#29439)
Previously, it will be treated as "re-run all jobs" when `jobIndex == 0`. So when you click re-run button on the first job, it triggers all the jobs actually.
This commit is contained in:
parent
29f149bd9f
commit
bad4ad7018
1 changed files with 8 additions and 3 deletions
|
@ -12,6 +12,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -262,10 +263,14 @@ func ViewPost(ctx *context_module.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rerun will rerun jobs in the given run
|
// Rerun will rerun jobs in the given run
|
||||||
// jobIndex = 0 means rerun all jobs
|
// If jobIndexStr is a blank string, it means rerun all jobs
|
||||||
func Rerun(ctx *context_module.Context) {
|
func Rerun(ctx *context_module.Context) {
|
||||||
runIndex := ctx.ParamsInt64("run")
|
runIndex := ctx.ParamsInt64("run")
|
||||||
jobIndex := ctx.ParamsInt64("job")
|
jobIndexStr := ctx.Params("job")
|
||||||
|
var jobIndex int64
|
||||||
|
if jobIndexStr != "" {
|
||||||
|
jobIndex, _ = strconv.ParseInt(jobIndexStr, 10, 64)
|
||||||
|
}
|
||||||
|
|
||||||
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
|
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -297,7 +302,7 @@ func Rerun(ctx *context_module.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if jobIndex != 0 {
|
if jobIndexStr != "" {
|
||||||
jobs = []*actions_model.ActionRunJob{job}
|
jobs = []*actions_model.ActionRunJob{job}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue