Skip to content

Support Actions concurrency syntax #32751

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

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions routers/web/repo/actions/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,14 @@ func Cancel(ctx *context_module.Context) {

actions_service.CreateCommitStatus(ctx, jobs...)

run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
if err != nil {
ctx.ServerError("GetRunByIndex", err)
}
if err := actions_service.EmitJobsIfReady(run.ID); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queue EmitJobsIfReady from Actions Notifier Job and Workflow Completed?

(The event source used by workflow_run and workflow_job webhooks / action trigger)

I mean whatif the job is cancelled by abandoning or other reasons.

Less explicit code that has the same weakness towards all ways of cancellation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a job completes (regardless of its status being successful, failed or cancelled), we need to check for other jobs that might have been blocked by it. I add the cancelled job to the queue so that the blocked jobs can be detected.

I mean whatif the job is cancelled by abandoning or other reasons.

Yes, this change cannot cover all cases where jobs are cancelled. So I am thinking that if we can do this check when a job reaches its final status (Success, Failed, Cancelled, and Skipped). Maybe we can move UpdateRunJob to services layer to allow it to call EmitJobsIfReady when a job's status is updated.

log.Error("Emit ready jobs of run %d: %v", run.ID, err)
}

for _, job := range updatedjobs {
_ = job.LoadAttributes(ctx)
notify_service.WorkflowJobStatusUpdate(ctx, job.Run.Repo, job.Run.TriggerUser, job, nil)
Expand Down