mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-03 15:07:12 +02:00
enhance(actions): add pending job status and align job statuses with GitHub (#39376)
This commit is contained in:
1 parent
0d09986790
commit
9e7b302bd3
45 files changed
+397
-189
No files matched your search
@@ -18,7 +18,7 @@ func ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// parameters:
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: page
|
||||
@@ -70,7 +70,7 @@ func ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// required: false
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: actor
|
||||
|
||||
@@ -581,7 +581,7 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// required: true
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: page
|
||||
@@ -626,7 +626,7 @@ func (Action) ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// required: false
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: actor
|
||||
|
||||
@@ -673,7 +673,7 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// required: true
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: page
|
||||
@@ -737,7 +737,7 @@ func (Action) ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// required: false
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: actor
|
||||
@@ -984,7 +984,7 @@ func ActionsListWorkflowRuns(ctx *context.APIContext) {
|
||||
// required: false
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: actor
|
||||
@@ -1624,7 +1624,7 @@ func ListWorkflowRunJobs(ctx *context.APIContext) {
|
||||
// required: true
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: page
|
||||
@@ -1701,7 +1701,7 @@ func ListWorkflowRunAttemptJobs(ctx *context.APIContext) {
|
||||
// required: true
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: page
|
||||
|
||||
@@ -120,7 +120,7 @@ func ListJobs(ctx *context.APIContext, ownerID, repoID, runID int64, runAttemptI
|
||||
func convertToInternal(s string) ([]actions_model.Status, error) {
|
||||
switch s {
|
||||
case "pending", "waiting", "requested", "action_required":
|
||||
return []actions_model.Status{actions_model.StatusBlocked}, nil
|
||||
return []actions_model.Status{actions_model.StatusBlocked, actions_model.StatusPending}, nil
|
||||
case "queued":
|
||||
return []actions_model.Status{actions_model.StatusWaiting}, nil
|
||||
case "in_progress":
|
||||
|
||||
@@ -352,7 +352,7 @@ func ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// required: false
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: actor
|
||||
@@ -393,7 +393,7 @@ func ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// parameters:
|
||||
// - name: status
|
||||
// in: query
|
||||
// description: workflow status (pending, queued, in_progress, failure, success, skipped)
|
||||
// description: workflow status (requested, pending, queued, in_progress, failure, success, skipped)
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: page
|
||||
|
||||
@@ -556,7 +556,7 @@ func MockActionsRunsJobs(ctx *context.Context) {
|
||||
|
||||
{
|
||||
ID: finalID, Link: jobLink(finalID), JobID: "final", Name: "final",
|
||||
Status: actions_model.StatusBlocked.String(), Duration: "0s",
|
||||
Status: actions_model.StatusPending.String(), Duration: "0s",
|
||||
Needs: []string{"local_caller", "cross_caller"},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ func (data *actionRunListData) processActionRuns(ctx *context.Context) bool {
|
||||
for _, job := range jobs {
|
||||
// A deferred matrix is unresolvable until its needs finish, so the whole per-job block
|
||||
// is skipped: parsing the payload would report a valid workflow as invalid.
|
||||
if job.IsMatrixDeferred || !job.Status.In(actions_model.StatusWaiting, actions_model.StatusBlocked) {
|
||||
if job.IsMatrixDeferred || !job.Status.In(actions_model.StatusWaiting, actions_model.StatusBlocked, actions_model.StatusPending) {
|
||||
continue
|
||||
}
|
||||
if err := actions.ValidateWorkflowContent(job.WorkflowPayload); err != nil {
|
||||
|
||||
@@ -766,14 +766,10 @@ func fillViewRunResponseCurrentJob(ctx *context_module.Context, resp *ViewRespon
|
||||
}
|
||||
}
|
||||
|
||||
// describePendingJobDetail explains why a blocked or waiting job has not started
|
||||
// yet, so the user can tell whether it is waiting on its dependencies or on an
|
||||
// available runner. It returns an empty string when the job is not pending or the
|
||||
// cause can't be determined (the caller keeps the generic status label then).
|
||||
// describePendingJobDetail explains why a pending or waiting job has not started, or returns an empty string when it can't tell
|
||||
func describePendingJobDetail(ctx *context_module.Context, current *actions_model.ActionRunJob, jobs []*actions_model.ActionRunJob) string {
|
||||
switch {
|
||||
case current.Status.IsBlocked():
|
||||
// A blocked job is held back by the jobs listed in its `needs`.
|
||||
case current.Status.IsPending():
|
||||
if pending := pendingNeeds(current, jobs); len(pending) > 0 {
|
||||
return ctx.Locale.TrString("actions.runs.waiting_for_dependent_jobs", strings.Join(pending, ", "))
|
||||
}
|
||||
@@ -852,7 +848,7 @@ func convertToViewModel(ctx context.Context, locale translation.Locale, cursors
|
||||
viewJobs = append(viewJobs, &ViewJobStep{
|
||||
Summary: v.Name,
|
||||
Duration: v.Duration().String(),
|
||||
Status: status.String(),
|
||||
Status: util.Iif(status.IsWaiting(), actions_model.StatusPending, status).String(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ func TestConvertToViewModelCancellingTaskDoesNotRenderRunningSteps(t *testing.T)
|
||||
{
|
||||
Summary: "Complete job",
|
||||
Duration: "0s",
|
||||
Status: "waiting",
|
||||
Status: "pending",
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expectedViewJobs, viewJobSteps)
|
||||
|
||||
Reference in new issue
Block a user