diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2023-07-25 11:15:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 11:15:55 +0800 |
commit | 44781f9f5c4ede618660d8cfe42437f0e8dc22a0 (patch) | |
tree | efcdc2e7876ede8c7e721432760e6ef9cefe4806 /models/migrations | |
parent | 5db640abcd8608b065a1b390404bba2233220c95 (diff) | |
download | gitea-44781f9f5c4ede618660d8cfe42437f0e8dc22a0.tar.gz gitea-44781f9f5c4ede618660d8cfe42437f0e8dc22a0.zip |
Implement auto-cancellation of concurrent jobs if the event is push (#25716)
- cancel running jobs if the event is push
- Add a new function `CancelRunningJobs` to cancel all running jobs of a
run
- Update `FindRunOptions` struct to include `Ref` field and update its
condition in `toConds` function
- Implement auto cancellation of running jobs in the same workflow in
`notify` function
related task: https://github.com/go-gitea/gitea/pull/22751/
---------
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v1_21/v268.go | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index bfe4b56cd1..fc11d54071 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -517,6 +517,8 @@ var migrations = []Migration{ NewMigration("Reduce commit status", v1_21.ReduceCommitStatus), // v267 -> v268 NewMigration("Add action_tasks_version table", v1_21.CreateActionTasksVersionTable), + // v268 -> v269 + NewMigration("Update Action Ref", v1_21.UpdateActionsRefIndex), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v1_21/v268.go b/models/migrations/v1_21/v268.go new file mode 100644 index 0000000000..332793ff07 --- /dev/null +++ b/models/migrations/v1_21/v268.go @@ -0,0 +1,16 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_21 //nolint + +import ( + "xorm.io/xorm" +) + +// UpdateActionsRefIndex updates the index of actions ref field +func UpdateActionsRefIndex(x *xorm.Engine) error { + type ActionRun struct { + Ref string `xorm:"index"` // the commit/tag/… causing the run + } + return x.Sync(new(ActionRun)) +} |