forgejo/.deadcode-out
Mathieu Fenniak c434b963b4 feat: implement "concurrency" block in Forgejo Actions at the workflow level (#9434)
Currently references a pre-release version of `code.forgejo.org/forgejo/runner/v11`, pending release of https://code.forgejo.org/forgejo/runner/pulls/1026.

Fixes #5914.

This PR is quite large, but it can be reviewed commit-by-commit in relatively small, logical chunks.

Adds support for workflows with a `concurrency` block, and submembers `group` and `cancel-in-progress`.  For example:
```
on:
  workflow_dispatch:
jobs:
  rust-checks:
    runs-on: debian-latest
    steps:
      - run: sleep 300
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: false
```

The concurrency block effectively ends up with four supported behaviors that users will want to choose from:
- Backwards compatibility / default -- if omitted completely, the existing Forgejo behavior will be implemented.  That behavior is that push and pull request synchronize events will cancel all previous runs on the same repository, branch, and workflow.
- Unlimited concurrency -- if the `cancel-in-progress` value is set to `false` and no `group` is provided, then the previously described Forgejo behavior will be disabled and an unlimited number of workflows can be executed simultaneously (to the maximum supported by the Forgejo Runner capacity).
- Queue-behind -- if a `group` is provided and `cancel-in-progress: false` is set, then every new action run with in the same repository with the same group value will be queued behind previous workflow runs, allowing only one workflow to execute at a time in the group, but allowing all workflows to finish naturally.
- Cancel-in-progress -- if a `group` is provided and `cancel-in-progress: true` is set, then every new action run with in the same repository with the same group value will cause previously queued or running runs to be cancelled, allowing only one workflow to execute at a time in the group, but preferring execution of the most recent workflow.

Both the `group` and `cancel-in-progress` values can access values from the `github`, `inputs` and `vars` context for dynamic behavior.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [x] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
  - https://codeberg.org/forgejo/docs/pulls/1513
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/9434): <!--number 9434 --><!--line 0 --><!--description aW1wbGVtZW50ICJjb25jdXJyZW5jeSIgYmxvY2sgaW4gRm9yZ2VqbyBBY3Rpb25zIGF0IHRoZSB3b3JrZmxvdyBsZXZlbA==-->implement "concurrency" block in Forgejo Actions at the workflow level<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9434
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-03 18:43:02 +02:00

241 lines
4 KiB
Text

forgejo.org/cmd
NoMainListener
forgejo.org/cmd/forgejo
ContextSetNoInit
ContextSetNoExit
ContextSetStderr
ContextGetStderr
ContextSetStdout
ContextSetStdin
forgejo.org/models
IsErrSHANotFound
IsErrMergeDivergingFastForwardOnly
forgejo.org/models/auth
WebAuthnCredentials
forgejo.org/models/db
TruncateBeans
InTransaction
DumpTables
GetTableNames
forgejo.org/models/dbfs
file.renameTo
Create
Rename
forgejo.org/models/forgejo/semver
GetVersion
SetVersionString
SetVersion
forgejo.org/models/git
RemoveDeletedBranchByID
forgejo.org/models/issues
IsErrUnknownDependencyType
IsErrIssueWasClosed
forgejo.org/models/organization
SearchMembersOptions.ToConds
forgejo.org/models/perm/access
GetRepoWriters
forgejo.org/models/repo
WatchRepoMode
forgejo.org/models/user
IsErrExternalLoginUserAlreadyExist
IsErrExternalLoginUserNotExist
NewFederatedUser
IsErrUserSettingIsNotExist
GetUserAllSettings
DeleteUserSetting
GetFederatedUser
forgejo.org/modules/activitypub
NewContext
Context.APClientFactory
forgejo.org/modules/assetfs
Bindata
forgejo.org/modules/auth/password/hash
DummyHasher.HashWithSaltBytes
NewDummyHasher
forgejo.org/modules/auth/password/pwn
WithHTTP
forgejo.org/modules/base
SetupGiteaRoot
forgejo.org/modules/cache
GetInt
WithNoCacheContext
RemoveContextData
forgejo.org/modules/emoji
ReplaceCodes
forgejo.org/modules/eventsource
Event.String
forgejo.org/modules/forgefed
NewForgeFollow
NewForgeUndoLike
ForgeUndoLike.UnmarshalJSON
ForgeUndoLike.Validate
NewPersonIDFromModel
GetItemByType
JSONUnmarshalerFn
NotEmpty
ToRepository
OnRepository
forgejo.org/modules/git
AllowLFSFiltersArgs
AddChanges
AddChangesWithArgs
CommitChanges
CommitChangesWithArgs
SetUpdateHook
openRepositoryWithDefaultContext
ToEntryMode
forgejo.org/modules/gitrepo
GetBranchCommitID
GetWikiDefaultBranch
forgejo.org/modules/graceful
Manager.TerminateContext
Manager.Err
Manager.Value
Manager.Deadline
forgejo.org/modules/hcaptcha
WithHTTP
forgejo.org/modules/hostmatcher
HostMatchList.AppendPattern
forgejo.org/modules/json
StdJSON.Marshal
StdJSON.Unmarshal
StdJSON.NewEncoder
StdJSON.NewDecoder
StdJSON.Indent
forgejo.org/modules/log
NewEventWriterBuffer
forgejo.org/modules/markup
GetRendererByType
RenderString
IsMarkupFile
forgejo.org/modules/markup/console
Render
RenderString
forgejo.org/modules/markup/markdown
RenderRawString
forgejo.org/modules/markup/mdstripper
stripRenderer.AddOptions
StripMarkdown
forgejo.org/modules/markup/orgmode
RenderString
forgejo.org/modules/process
Manager.ExecTimeout
forgejo.org/modules/queue
newBaseChannelSimple
newBaseChannelUnique
newBaseRedisSimple
newBaseRedisUnique
testStateRecorder.Records
testStateRecorder.Reset
newWorkerPoolQueueForTest
forgejo.org/modules/queue/lqinternal
QueueItemIDBytes
QueueItemKeyBytes
ListLevelQueueKeys
forgejo.org/modules/setting
NewConfigProviderFromData
GitConfigType.GetOption
InitLoggersForTest
forgejo.org/modules/sync
StatusTable.Start
StatusTable.IsRunning
forgejo.org/modules/timeutil
GetExecutableModTime
MockSet
MockUnset
forgejo.org/modules/translation
MockLocale.Language
MockLocale.TrString
MockLocale.Tr
MockLocale.TrN
MockLocale.TrPluralString
MockLocale.TrPluralStringAllForms
MockLocale.TrSize
MockLocale.HasKey
MockLocale.PrettyNumber
forgejo.org/modules/translation/localeiter
IterateMessagesContent
forgejo.org/modules/util
OptionalArg
forgejo.org/modules/util/filebuffer
CreateFromReader
forgejo.org/modules/validation
IsErrNotValid
forgejo.org/modules/web
RouteMock
RouteMockReset
forgejo.org/modules/zstd
NewWriter
Writer.Write
Writer.Close
forgejo.org/routers/web/org
MustEnableProjects
forgejo.org/services/context
GetPrivateContext
forgejo.org/services/federation
FollowRemoteActor
forgejo.org/services/notify
UnregisterNotifier
forgejo.org/services/repository
IsErrForkAlreadyExist
forgejo.org/services/repository/files
ContentType.String
forgejo.org/services/repository/gitgraph
Parser.Reset
forgejo.org/services/webhook
NewNotifier