Skip to content

Expire pull request artifacts sooner and cancel superseded runs - #623

Merged
hannesa2 merged 1 commit into
masterfrom
ci-expire-pr-artifacts-and-cancel-superseded
Sep 13, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
ci-expire-pr-artifacts-and-cancel-superseded

Conversation

@goneng

@goneng goneng commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Closes #615, as agreed there.

Retention. The four upload-artifact steps set nothing, so everything
falls back to the 90 day default and a pull request build (~21 MB across
dmg and zip per arch) is kept as long as a release. They now keep a
pull request's uploads for a week and leave master and tag uploads at 90:

retention-days: ${{ github.event_name == 'pull_request' && 7 || 90 }}

The same line is on all four steps, including the two screenshot ones
that only run on pull requests today, so the value stays right if those
conditions ever change.

Concurrency. A second push to a branch starts another full matrix
build beside the one already running. Grouping by pull request number
replaces it instead:

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

The fallback is what keeps master and tag builds safe: off a pull request
github.event.pull_request.number is empty, so each run falls back to its
own run id, gets a group to itself and is never cancelled by a later one.

Test plan

  • The file still parses, and the four upload steps each carry the value
  • This pull request's own run is the first test of both: it builds with
    this workflow, so its artifacts should expire in 7 days rather than 90
  • Cancellation is visible the next time anyone pushes twice to a branch;
    a superseded run then shows as cancelled, which is the point of it

@goneng
goneng marked this pull request as ready for review September 13, 2026 07:42
A pull request build is worth downloading while the pull request is open
and not much after it, and a second push to a branch starts a full
matrix build beside the one already running rather than replacing it.

* Keep what a pull request uploads for a week, and everything master and
  the tags upload for the 90 days they are kept now
* Group runs by pull request so a push replaces the run in flight, and
  fall back to the run id everywhere else, which gives master and tag
  builds a group each and leaves them to finish
@goneng
goneng force-pushed the ci-expire-pr-artifacts-and-cancel-superseded branch from 4bc9ff9 to 8241fd6 Compare September 13, 2026 07:46
@hannesa2

Copy link
Copy Markdown
Contributor

Screenshot differs: emulatorApi=arm64 with 4 screenshot(s)

setpoint (old) | diff | actual screenshot (new)

00-commit-context-menu.pngscreenshot

01-history-view.pngscreenshot

02-main-window.pngscreenshot

03-staging-view.pngscreenshot

@hannesa2 hannesa2 added the pipeline CI pipeline label Sep 13, 2026
@hannesa2
hannesa2 merged commit e78baf1 into master Sep 13, 2026
3 checks passed
@hannesa2
hannesa2 deleted the ci-expire-pr-artifacts-and-cancel-superseded branch September 13, 2026 08:14

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@goneng
Everything comes with an disadvantage. With this I can't test stuff in parallel, so it serialize the observations in CI

@goneng goneng Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@hannesa2 , Fair point, and it was my suggestion, so let me offer a way out...

Since 13 Sep the rule has cancelled four runs on your screenshot PRs
(#658, #661, #681), including one this morning, so it is costing you
observations rather than just theory.

Two options, your pick:

  1. A per-PR opt out, so the PRs where you compare artifacts keep every run:

    concurrency:
       group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
       cancel-in-progress: ${{ !contains(github.event.pull_request.labels.*.name, 'keep-runs') }}

    Put the keep-runs label on before you push and nothing is cancelled there.
    (The expression is read when the run is created, so labeling mid-run does not
    rescue a run already going.)

  2. Drop the three lines.
    What CI: Expire PR artifacts sooner and cancel superseded CI runs #615 was really about was retention-days on the artifacts, and that stays either way.
    Cancelling mostly buys queue slots.

Say which you prefer and I will open the PR. Gating on draft instead would not
help, since all my PRs start as drafts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Option 1 sounds good

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since 13 Sep the rule has cancelled four runs on your screenshot PRs
(#658, #661, #681), including one this morning, so it is costing you
observations rather than just theory.

More then this, I've always to wait, till it's finished. You don't see this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Option 1 sounds good

On it!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

PR #684 is ready for your review, @hannesa2

goneng added a commit to goneng/gitx that referenced this pull request Sep 19, 2026
Cancelling a superseded run throws away the artifacts it would have
uploaded, which is the very thing the screenshot experiments in gitx#658,
gitx#661 and gitx#681 exist to look at, and it makes each variant wait for the
running build before it can start. Raised by hannesa2 on gitx#623.

- Read cancel-in-progress from the pull request's labels, so that a
  pull request labelled keep-runs runs every push to completion
- Leave every other pull request cancelling as it does now, and master
  and tag builds untouched, since their group is keyed per run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipeline CI pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: Expire PR artifacts sooner and cancel superseded CI runs

2 participants