ci: add concurrency group to functions.yaml to cancel redundant runs#3536
ci: add concurrency group to functions.yaml to cancel redundant runs#3536Ankitsinghsisodya wants to merge 2 commits intoknative:mainfrom
Conversation
Without a concurrency configuration, pushing multiple commits to the same PR triggers multiple simultaneous workflow runs. Add a concurrency group keyed on workflow name and ref so that only the latest run for a given branch or PR is active, cancelling any in-progress predecessor. Fixes knative#3531
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ankitsinghsisodya The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Ankitsinghsisodya. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Pull request overview
Adds GitHub Actions workflow concurrency controls to reduce redundant CI runs for the Functions workflow.
Changes:
- Introduces a
concurrencyblock in.github/workflows/functions.yamlto cancel in-progress runs when a new run starts for the same group key.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/workflows/functions.yaml
Outdated
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true |
There was a problem hiding this comment.
The PR description/test plan says pushes to main should run to completion with a unique concurrency group per push, but group: ${{ github.workflow }}-${{ github.ref }} will use refs/heads/main for all main pushes, so a newer push can cancel an in-progress main run. If the intent is to only cancel redundant PR runs, consider making cancel-in-progress conditional (e.g., only for pull_request events) and/or adjusting the group key to differentiate main pushes.
There was a problem hiding this comment.
Good catch. Pushes to main trigger build and publish jobs — cancelling those mid-flight would be dangerous. Fixed in f9ebdf5 by making cancel-in-progress conditional:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}Now only redundant PR runs are cancelled; main pushes always run to completion.
Pushes to main trigger build and publish jobs. Cancelling an in-progress main run when another push arrives could interrupt image publishing. Make cancel-in-progress conditional on pull_request events only.
Summary
concurrencyblock to.github/workflows/functions.yamlcancel-in-progress: true, any in-progress run for the same branch or PR ref is cancelled when a new run startsTest plan
mainstill run to completion (each push to main gets its own group key)Fixes #3531