Skip to content

ci: add concurrency group to functions.yaml to cancel redundant runs#3536

Open
Ankitsinghsisodya wants to merge 2 commits intoknative:mainfrom
Ankitsinghsisodya:ci/add-concurrency-group-functions-workflow
Open

ci: add concurrency group to functions.yaml to cancel redundant runs#3536
Ankitsinghsisodya wants to merge 2 commits intoknative:mainfrom
Ankitsinghsisodya:ci/add-concurrency-group-functions-workflow

Conversation

@Ankitsinghsisodya
Copy link
Copy Markdown

Summary

  • Adds a concurrency block to .github/workflows/functions.yaml
  • Without it, pushing multiple commits to the same PR (or re-running after a fixup) queues multiple workflow runs simultaneously, wasting runner minutes on results that will be superseded
  • With cancel-in-progress: true, any in-progress run for the same branch or PR ref is cancelled when a new run starts

Test plan

  • Push two commits to a PR branch in quick succession and confirm the first run is cancelled when the second starts
  • Confirm pushes to main still run to completion (each push to main gets its own group key)

Fixes #3531

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
Copilot AI review requested due to automatic review settings March 27, 2026 19:39
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Mar 27, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ankitsinghsisodya
Once this PR has been reviewed and has the lgtm label, please assign gauron99 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 27, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@knative-prow knative-prow bot requested review from dsimansk and jrangelramos March 27, 2026 19:39
@knative-prow knative-prow bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label Mar 27, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Mar 27, 2026

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@knative-prow knative-prow bot added the size/XS 🤖 PR changes 0-9 lines, ignoring generated files. label Mar 27, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Actions workflow concurrency controls to reduce redundant CI runs for the Functions workflow.

Changes:

  • Introduces a concurrency block in .github/workflows/functions.yaml to 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.

Comment on lines +19 to +21
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/XS 🤖 PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: add concurrency group to functions.yaml to cancel redundant runs

2 participants