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

.github/workflows: Cancel redundant workflow runs #1889

Merged
merged 3 commits into from
Sep 12, 2023

Conversation

t-b
Copy link
Collaborator

@t-b t-b commented Sep 9, 2023

Evern since the move to github actions in 70daa61 (CI: add GH actions for
main and release builds, 2023-04-20) we just executed the workflows for
every branch push.

This can quickly result in the workflow queue being clogged. There is also
no point in executing older versions of the same branch when a newer
version is available.

The version here supports multiple workflows 1. And also cancels, on
purpose, redundant workflows on main and the release branches. See [2]
for a future way to don't do that on special branches.

[2]: https://stackoverflow.com/questions/68418857/how-to-cancel-existing-runs-when-a-new-push-happens-on-github-actions-but-onlyThanks for opening a PR in MIES ✨!

t-b added 2 commits September 9, 2023 19:27
Evern since the move to github actions in 70daa61 (CI: add GH actions for
main and release builds, 2023-04-20) we just executed the workflows for
every branch push.

This can quickly result in the workflow queue being clogged. There is also
no point in executing older versions of the same branch when a newer
version is available.

The version here supports multiple workflows [1]. And also cancels, on
purpose, redundant workflows on main and the release branches. See [2]
for a future way to don't do that on special branches.

[1]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
[2]: https://stackoverflow.com/questions/68418857/how-to-cancel-existing-runs-when-a-new-push-happens-on-github-actions-but-only
The FTPUpload job is responsible for storing the job artefacts of all
jobs regardless if the jobs passed or failed.

But we don't need to store the artefacts if the job was cancelled.

This avoids a failed job in case of cancellation and also the nagging
email from github actions.
@t-b t-b requested a review from timjarsky as a code owner September 9, 2023 17:30
@t-b t-b self-assigned this Sep 9, 2023
@t-b
Copy link
Collaborator Author

t-b commented Sep 9, 2023

Not yet working for main, see https://github.com/AllenInstitute/MIES/actions.

The recent fix in one of the previous commits (.github/workflows: Cancel redundant workflow
runs, 2023-09-08) did not work for the main branch as the error message on
cancelling was [1]:

> Cancelling since a deadlock for concurrency group 'Build Release-refs/heads/main'
> was detected between 'top level workflow' and 'CallPR'

So we now only cancel the CallPR workflow.

[1]: https://github.com/AllenInstitute/MIES/actions/runs/6132292975
@t-b t-b merged commit e9255ee into release/2.7 Sep 12, 2023
@t-b t-b deleted the feature/1889-kill-redundant-gh-action-runs-backport branch September 12, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant