Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use GitHub Actions concurrency groups to cancel workflows #25243

Conversation

sebastianliebscher
Copy link
Contributor

@sebastianliebscher sebastianliebscher commented Sep 9, 2023

SUMMARY

This PR removes custom scripts to cancel running GitHub Actions workflows and replaces them with the built-in functionality concurrency groups.

This will cancel all running workflow jobs for PRs only. In case it is not a PR, this won't cancel running jobs as run_id is unique.

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
  cancel-in-progress: true

Partially reverts #12090


In case we want to cancel running jobs for commits to master or release tags also, it can be modified to:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

TESTING INSTRUCTIONS

You can see the cancelled workflows for the first commit:
image

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@villebro
Copy link
Member

villebro commented Sep 9, 2023

@sebastianliebscher nice work, looking forward to reviewing this once it's out of draft state!

@sebastianliebscher
Copy link
Contributor Author

ping @villebro

@rusackas
Copy link
Member

This one seems to have slipped under the radar, but it's a fantastic idea! It just needs a rebase, and I think we should be all good. CC @mistercrunch since he might want to take a look at this too.

@mistercrunch
Copy link
Member

LGTM, let's rebase and merge it!

mistercrunch added a commit that referenced this pull request Feb 1, 2024
Taking over #25243, where
@sebastianliebscher did great work and submitted this idea. I'm
re-opening under a new PR to accelerate things a bit. I've been
triggering lots and lots of CI jobs while working on docker and feeling
guilty about my carbon footprint.

Here I grepped for workflows that have pull_request events and
copy pasted the exact same snippet everywhere except for one place and
that's the comment-triggered ephemeral builds, where I reference the
issue number instead of the PR number. This should allow for someone
to oops and retrigger the ephemeral build, and the lastest one should
always land first, fixing potential race conditions
@mistercrunch
Copy link
Member

Thank @sebastianliebscher for the idea/code, took over here -> #26945 closing this one

DevNoctis1001 added a commit to DevNoctis1001/Superset-data_visualization that referenced this pull request Feb 11, 2024
Taking over apache/superset#25243, where
@sebastianliebscher did great work and submitted this idea. I'm
re-opening under a new PR to accelerate things a bit. I've been
triggering lots and lots of CI jobs while working on docker and feeling
guilty about my carbon footprint.

Here I grepped for workflows that have pull_request events and
copy pasted the exact same snippet everywhere except for one place and
that's the comment-triggered ephemeral builds, where I reference the
issue number instead of the PR number. This should allow for someone
to oops and retrigger the ephemeral build, and the lastest one should
always land first, fixing potential race conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants