Skip to content

Commit 15cc5c5

Browse files
committed
resolve conflicts
1 parent 989e274 commit 15cc5c5

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

models/migrations/migrations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func prepareMigrationTasks() []*migration {
394394
// Gitea 1.24.0 ends at database version 321
395395
newMigration(321, "Use LONGTEXT for some columns and fix review_state.updated_files column", v1_25.UseLongTextInSomeColumnsAndFixBugs),
396396
newMigration(322, "Extend comment tree_path length limit", v1_25.ExtendCommentTreePathLength),
397-
newMigration(323, "Add support for actions concurrency", v1_25.AddActionsConcurrency),
397+
newMigration(323, "Add support for actions concurrency", v1_25.AddActionsConcurrency),
398398
}
399399
return preparedMigrations
400400
}

models/migrations/v1_25/v323.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2025 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_25
5+
6+
import (
7+
"xorm.io/xorm"
8+
)
9+
10+
func AddActionsConcurrency(x *xorm.Engine) error {
11+
type ActionRun struct {
12+
RepoID int64 `xorm:"index unique(repo_index) index(repo_concurrency)"`
13+
RawConcurrency string
14+
ConcurrencyGroup string `xorm:"index(repo_concurrency)"`
15+
ConcurrencyCancel bool
16+
}
17+
18+
if err := x.Sync(new(ActionRun)); err != nil {
19+
return err
20+
}
21+
22+
type ActionRunJob struct {
23+
RepoID int64 `xorm:"index index(repo_concurrency)"`
24+
RawConcurrency string
25+
IsConcurrencyEvaluated bool
26+
ConcurrencyGroup string `xorm:"index(repo_concurrency)"`
27+
ConcurrencyCancel bool
28+
}
29+
30+
return x.Sync(new(ActionRunJob))
31+
}

routers/web/repo/actions/view.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,6 @@ func Rerun(ctx *context_module.Context) {
441441
return
442442
}
443443

444-
if err := run.LoadAttributes(ctx); err != nil {
445-
ctx.ServerError("run.LoadAttributes", err)
446-
return
447-
}
448-
notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run)
449-
450444
if run.RawConcurrency != "" {
451445
var rawConcurrency model.RawConcurrency
452446
if err := yaml.Unmarshal([]byte(run.RawConcurrency), &rawConcurrency); err != nil {
@@ -482,6 +476,12 @@ func Rerun(ctx *context_module.Context) {
482476
ctx.ServerError("UpdateRun", err)
483477
return
484478
}
479+
480+
if err := run.LoadAttributes(ctx); err != nil {
481+
ctx.ServerError("run.LoadAttributes", err)
482+
return
483+
}
484+
notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run)
485485
}
486486

487487
if jobIndexStr == "" { // rerun all jobs

services/actions/clear_tasks.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ func CancelAbandonedJobs(ctx context.Context) error {
129129

130130
// Collect one job per run to send workflow run status update
131131
updatedRuns := map[int64]*actions_model.ActionRunJob{}
132+
updatedJobs := []*actions_model.ActionRunJob{}
132133

133134
for _, job := range jobs {
134135
job.Status = actions_model.StatusCancelled
@@ -153,14 +154,15 @@ func CancelAbandonedJobs(ctx context.Context) error {
153154
}
154155
CreateCommitStatus(ctx, job)
155156
if updated {
157+
updatedJobs = append(updatedJobs, job)
156158
notify_service.WorkflowJobStatusUpdate(ctx, job.Run.Repo, job.Run.TriggerUser, job, nil)
157159
}
158160
}
159161

160162
for _, job := range updatedRuns {
161163
notify_service.WorkflowRunStatusUpdate(ctx, job.Run.Repo, job.Run.TriggerUser, job.Run)
162164
}
163-
EmitJobsIfReadyByJobs(updatedJobs)
165+
EmitJobsIfReadyByJobs(updatedJobs)
164166

165167
return nil
166168
}

0 commit comments

Comments
 (0)