Skip to content

ci: give each pull request its own release drafter run - #16213

Merged
jdaugherty merged 4 commits into
apache:8.0.xfrom
codeconsole:ci/release-drafter-pr-concurrency
Oct 1, 2026
Merged

jdaugherty merged 4 commits into
apache:8.0.xfrom
codeconsole:ci/release-drafter-pr-concurrency

Conversation

@codeconsole

Copy link
Copy Markdown
Contributor

Every pull request against a release branch computes the same release-drafter concurrency group, because the group is keyed on the branch it targets:

group: release-drafter-${{ github.event.pull_request.base.ref || github.ref_name }}
cancel-in-progress: true

Two pull requests pushed within seconds of each other therefore share one slot, and the later one cancels the earlier:

05:30:24  feat/hiddenmethod-handler-mapping        cancelled   (#16183)
05:30:36  perf/urlmapping-name-resolution-8.0.x    success

The evicted pull request shows a cancelled check with nothing wrong with it, and never receives the labels the run exists to apply. Anything that raises several pull requests at once — rebasing a stack, merging a branch into each of them — makes it routine.

Queueing instead of cancelling would not fix it: GitHub keeps one pending run per group and cancels the one pending before it, so a sweep of ten pull requests would still show eight cancellations, of queued runs rather than running ones.

The group is the pull request

group: release-drafter-${{ github.event.pull_request.number || github.ref_name }}

Pull requests no longer meet. cancel-in-progress still does the right thing within one subject: pushing twice to the same pull request supersedes its own earlier run, and pushes to a release branch still share a group by branch name.

A pull request run labels; it does not draft

disable-releaser: ${{ github.event_name == 'pull_request' }}

They shared a slot for a reason — two runs creating the same draft at once is how the duplicate drafts described in that file's header appear — so this removes the reason rather than working around it.

Release notes are built from merged pull requests. An open one contributes nothing to the draft, so the releaser was rewriting the draft it had already written. Checked against the live v8.0.0 draft: it lists merged pull requests only, which also corrects the claim in the workflow comment that the draft "picks up new PRs as soon as they are opened".

Labels still apply on every pull request event. The draft is written by pushes to the release branch, which is when a merge can actually change it.

./gradlew validateActions passes.

Every pull request against a release branch computed the same concurrency group -
the group is keyed on the branch it targets - so two of them pushed within seconds
of each other shared one slot and cancel-in-progress had the later kill the
earlier. The evicted pull request shows a cancelled check with nothing wrong with
it, and never gets the labels the run exists to apply. Raising several at once,
which is what rebasing a stack or merging a branch into each of them does, made it
routine: 16183 was cancelled 12 seconds in by an unrelated PR.

Queueing rather than cancelling would not have fixed it. GitHub holds one pending
run per group and cancels the one that was pending before it, so a sweep of ten
pull requests would still have shown eight cancellations, of queued runs.

The group is now the pull request, so they no longer meet. Pushing twice to one
pull request still supersedes its own earlier run, and pushes to a release branch
still share a group by branch.

They shared a slot for a reason - two runs creating the same draft at once is how
duplicate drafts appear - so a pull request run no longer writes one. Release notes
are built from merged pull requests: an open one contributes nothing, and the
releaser was rewriting the draft it had already written. Confirmed against the live
v8.0.0 draft, which lists merged pull requests only. Labels still apply on every
pull request event; the draft is written by the pushes that can change it.
@codecov

codecov Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.9308%. Comparing base (e40cb27) to head (52bc48a).
⚠️ Report is 1452 commits behind head on 8.0.x.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##                8.0.x     #16213        +/-   ##
==================================================
+ Coverage     54.1238%   58.9308%   +4.8069%     
- Complexity      20307      24441      +4134     
==================================================
  Files            2107       2174        +67     
  Lines          101144     107365      +6221     
  Branches        17921      19557      +1636     
==================================================
+ Hits            54743      63271      +8528     
+ Misses          38595      35229      -3366     
- Partials         7806       8865      +1059     

see 554 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Corrects the commit before this one, which passed `disable-releaser` to an action that has no
such input. The workflow's own run said so - "Unexpected input(s) 'disable-releaser'" - and then
tried to create a release and failed. The releaser therefore still ran on pull requests, so the
concurrency isolation added there did not prevent the concurrent writes it claimed to.

The pull request trigger was there so the autolabeler could label pull requests, and the action
pinned here cannot do that. release-drafter 7 split labelling into a second entrypoint,
release-drafter/release-drafter/autolabeler, and the entrypoint used here has no labelling in it
at all - its source mentions labels zero times, against twenty three in the autolabeler's.

So a pull request run applied no labels. On a pull request from a fork it could not write a draft
either: the token is read only, and the run failed with "Resource not accessible by integration",
hidden by continue-on-error. Runs that could only fail also cancelled each other, because every
pull request against a release branch computed the same concurrency group - which is how apache#16183
lost its check twelve seconds in, to an unrelated pull request that pushed after it.

Nothing is lost by removing the trigger and the collision goes with it. Drafts are still written
on every push to a release branch, which is when a merge can change them, and the concurrency
group is a branch again because a branch is the only subject left.

Restoring labels needs the autolabeler entrypoint, which is a separate action and not on the ASF
approved list - approved_patterns.yml carries only release-drafter/release-drafter@* - so it
wants an INFRA request first, and its own change.
The job held pull-requests: write for the autolabeler, and there is no autolabeler here any more.
What remains reads merged pull requests to build the draft, which the action does through
find-recent-merged-pull-requests, so the scope stays at read rather than going altogether: a
permissions block is restrictive, and an unnamed scope is denied.
@testlens-app

This comment has been minimized.

@jdaugherty

Copy link
Copy Markdown
Contributor

We intentionally changed the release drafter to not overlap b/c if a release gets posted or changed while doing a release, it causes the release to fail.

But we probably could go away from canceling the in progress if it's from a PR. That seems reasonable?

@jdaugherty

Copy link
Copy Markdown
Contributor

@codeconsole I think we should either close this PR or we should address the original concern with it conflicting with releases - we cannot run the drafter while a release is pending for that version.

…ress

The drafter and the release pipeline can touch the same release object. The drafter updates
whichever draft targets its branch, and the release being released is briefly a draft again
while pre-release moves its tag, so a drafter run in that window rewrites the release's tag,
name and body. Sharing a concurrency group with the pipeline was tried for this and undone:
the pipeline waits at approval gates for days, and every push queued the drafter behind it.

So the drafter now skips instead. Its first step lists the runs of release.yml and
release-close.yml, maps a release run's head ref - the tag - to the branch it was cut from,
and if any run for this branch is not completed, including one waiting at a gate, the draft is
left exactly as it was. Nothing useful is lost: the next version is not known until the close
has merged back, and the first push after the pipeline completes brings the draft up to date.
If the runs cannot be listed, the drafter holds off and warns rather than guess.

The seed and drafter steps are conditional on the guard, the verify step reports a hold as a
hold rather than as a missing draft, and the job asks for actions: read to list the runs.
@jdaugherty

jdaugherty commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary of where this landed after going through the history and the live state.

What this PR now does. The head (02a2338) removes the pull_request trigger. The title and body still describe the first commit's per-PR concurrency group, which the second commit reverted, so they need updating. Removing the trigger is right:

  • The trigger existed for the autolabeler, and the action pinned here can no longer label. release-drafter 7 (picked up here on March 16) split labelling into a separate release-drafter/release-drafter/autolabeler action; the root action runs only the drafter and no longer has the disable-releaser / disable-autolabeler inputs. Every fix/, test/, docs/ and deps/ branch merged this week has no label.
  • A PR run writes the same draft the last push already wrote (notes are built from merged PRs), and on a fork PR it cannot write at all: "Resource not accessible by integration", hidden by continue-on-error.
  • Yesterday there were eight PR-event writes to the 8.0.x draft in fifteen hours while the RC2 pipeline was gated. That volume is what makes a collision with a release likely, and it is what cancelled unrelated PRs' checks.

The concern I raised: the drafter vs. a release in progress. The shared concurrency group from January (c7e169a) was removed in May (d4608a4) because the pipeline waits at approval gates for days and every push queued a drafter run behind it. So the drafter has been running during releases since May; this PR neither adds nor removes that. The actual hazard is narrower than "any overlap":

  • The drafter only writes to a release whose draft flag is true. It takes the first draft targeting the branch, regardless of tag, and PATCHes its tag_name, name, body, target_commitish and draft: true.
  • pre-release force-moves the tag, which flips the release back to a draft until the script PATCHes draft: false. A drafter run in that window adopts the release and rewrites it. The same happens to a drafter run already in flight when the draft is published.
  • A published release is never touched. The RC2 pipeline has been gated since Sept 29; every drafter run since logs "last release: v8.0.0-RC2" and updates the separate v8.0.0 draft. RC2 is untouched.

What we decided.

  1. Keep the removal of the pull_request trigger.
  2. Add a hold-off step as the first step of the drafter job. It lists release.yml and release-close.yml runs, maps a release run's head ref (the tag, e.g. v8.0.0-RC2) to its branch (8.0.x), and if any run for the branch is not completed, including one waiting at a vote gate, the seed and drafter steps are skipped and the draft is left exactly as it was. It skips rather than queues, so the May problem does not come back. The next version is not known until the close merges back anyway, so a stale draft during a release costs nothing; the first push after the pipeline completes brings it up to date. If the runs cannot be listed it holds off and warns. The job gains actions: read for the listing. A commit adding this follows on this branch (maintainer edits are enabled). The merge with current 8.0.x, which has since bumped the pin to v7.7.0, is clean, and validateRepositoryConventions passes on the result.
  3. A bad release is deleted and restaged, never flipped back to draft, so the guard keys on pipeline runs rather than on release objects. When restaging, cancel the stale pipeline run, or it keeps the drafter held.

A release, step by step, with the hold-off in place. Using 8.0.0 on 8.0.x as the example, with v8.0.0-RC2 as the last published release.

  1. Before publishing. The branch's draft is v8.0.0, computed from the last published tag. The last PR for the release is merged; that push runs the drafter, no pipeline run exists for 8.0.x, so it drafts: the draft now lists every PR merged since RC2. If the tag or name needs hand-editing (RCs and milestones), that happens now. Publish once that last drafter run has finished, so nothing is mid-write.
  2. Publish. The draft becomes the published release v8.0.0 and the tag is created. GitHub fires release: published and release.yml starts. From this moment every drafter run for 8.0.x finds a release.yml run whose head ref is v8.0.0, maps it to 8.0.x, sees it is not completed, and holds. The release has no draft flag, so even a run that somehow got past the guard would not select it.
  3. Stage Jar Files. pre-release checks out the tag, commits the released version, force-moves the tag, which flips the release back to a draft for a moment, and PATCHes draft: false. A push to 8.0.x in this window produces a held drafter run and nothing writes to the release. Without the hold, a drafter run that listed releases in that window would adopt v8.0.0 as "the draft" and rewrite its tag, name and body; that is the January failure.
  4. Source and upload. These read the published release by tag and upload assets to it. Still held.
  5. Vote gate. The run sits in waiting, usually for days. Every push to 8.0.x during the vote produces a held run with a notice naming the pipeline run. No draft exists for 8.0.x and none is created; the release is not touched. Other branches are unaffected, since the hold is per branch.
  6. Vote succeeds. The release, docs, sdkman and close jobs run. Close runs post-release: milestone closed, prerelease flag removed and latest set on the published release, merge-back branch created with the bumped snapshot version, merge-back PR opened. Still held until the run completes. release-close.yml, the manual form of the close step, is treated the same way.
  7. Pipeline completed. The hold lifts. Merging the merge-back PR pushes to 8.0.x, the drafter runs, the last published release is now v8.0.0, and it creates the new draft v8.0.1 listing every PR merged since v8.0.0, including those merged during the vote. Normal operation from here.
  8. Vote fails. Delete the release and its tag and cancel the waiting pipeline run; while it waits it keeps the drafter held. The next push to 8.0.x then drafts again: the last published release is RC2 once more, so the draft is recreated as v8.0.0 with every PR since RC2, including the fixes merged meanwhile. Restage by publishing that draft.

Not covered, and not coverable by any group or guard: a drafter run that is already inside the action (the few seconds between listing releases and writing) when Publish is clicked will rewrite a hand-edited RC tag. Publish after the last merge's drafter run has finished.

Separate follow-ups, not for this PR: restoring labels needs release-drafter/release-drafter/autolabeler@<sha> on the ASF allowlist (approved_patterns.yml carries only release-drafter/release-drafter@*), then its own small pull_request workflow with pull-requests: write; labelling fork PRs would additionally need pull_request_target. Every drafter run also warns that categories[*].labels is deprecated in favour of when:.

@jdaugherty
jdaugherty merged commit 89ec7b8 into apache:8.0.x Oct 1, 2026
85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants