mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-02 13:44:16 +09:00
Backport https://github.com/go-gitea/gitea/pull/40106 Repository-level and instance-level runners still picked up waiting jobs of repositories with Actions disabled. https://github.com/go-gitea/gitea/pull/30331 only covered owner-level runners, by filtering them out in SQL. Pickup now checks the Actions unit of each job it is about to claim, for every runner scope, and cancels the job instead when Actions is disabled, also honoring `DISABLED_REPO_UNITS`. Disabling Actions therefore cancels its queued jobs once a matching runner polls, instead of leaving them waiting until `ABANDONED_JOB_TIMEOUT`. Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
c9e1805cc9
commit
6c8eaaf9e7
7 files changed
+58
-56
No files matched your search
@@ -94,11 +94,13 @@ func PickTask(ctx context.Context, runner *actions_model.ActionRunner) (*runnerv
|
||||
}
|
||||
}
|
||||
|
||||
t, ok, err := actions_model.CreateTaskForRunner(ctx, runner)
|
||||
t, cancelledJobs, err := actions_model.CreateTaskForRunner(ctx, runner)
|
||||
NotifyWorkflowJobsAndRunsStatusUpdate(context.WithoutCancel(ctx), cancelledJobs) // the cancellations are committed even if the runner went away
|
||||
EmitJobsIfReadyByJobs(cancelledJobs)
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("CreateTaskForRunner: %w", err)
|
||||
}
|
||||
if !ok {
|
||||
if t == nil {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user