Skip to content

ci(release): rehearse the release PR with the build workflows - #1468

Open
robinnsc wants to merge 1 commit into
ci/release-pleasefrom
ci/release-callable-workflows
Open

robinnsc wants to merge 1 commit into
ci/release-pleasefrom
ci/release-callable-workflows

Conversation

@robinnsc

@robinnsc robinnsc commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Release automation (#1395), PR 5 of 6. #1464 (PR title check), #1465 (signing in a called workflow) and #1466 (freeze-migrations) have merged. Stack: #1467 release-please ← #1468 rehearsal ← #1469 release-publish. Merge in that order.

What

Adds two workflows for the release PR and makes the three build workflows reusable.

  • release-rehearsal.yml dry-runs release-image (each backend image), release-dev-image and npm-publish on each push to the release PR's branch, with the commit and the version in the release-please manifest. Its crates job runs release-crates.yml's plan and verify steps (the publish plan, cargo package --workspace --locked on the release's toolchain, the crates.io package rules). A newer push cancels the older run. It also runs on workflow_dispatch from main. Its target job checks the commit with resolve-release-commit before any job checks it out, because the crates job builds it: GitHub serves every PR's head by SHA, a fork's included, so without the check a dispatch could build any commit in a run on main. It never runs on pull requests, so a fork PR never starts it.
  • release-pr.yml holds one check, release-pr, with contents and actions read only:
    • on any other PR or queue entry, it checks only that .release-please-manifest.json and Cargo.toml name one version, so a version change by hand cannot leave the manifest behind;
    • on the release PR, it checks that the three manifests name one version, that cargo metadata --locked and devtools/check-released-through pass, and that the branch holds only release-please's commit, which may change only the manifest and the files that release-please-config.json on main lists, and at most push-release-pr's commit, which may change only the files in .github/release-pr-files.txt, the list push-release-pr reads; then it waits up to 90 minutes for the rehearsal run on the PR's head and passes only if that run succeeded;
    • on the release PR's merge-queue entry, it passes only when the entry's tree is the release PR head's tree, so a PR queued ahead of it cannot reach the tagged commit.
  • Build workflows: release-image, release-dev-image and npm-publish get a workflow_call trigger with their dispatch inputs and a commit input. With dry_run and a commit on main or the release PR's head, the gate rehearses that commit before it is tagged: it skips the tag checks and keeps the version checks. Each gate's first step refuses to run outside ExtendDB/extenddb. The three gates resolve the commit with one composite action, .github/actions/resolve-release-commit, which also outputs the version, so the gates no longer check the tag's shape themselves. Image and SBOM artifacts are named after the image, and npm-publish downloads only its own binaries, so calls in one run never share an artifact. A dry run's concurrency group is named after the calling workflow, so a rehearsal and a dispatched dry run do not replace each other's pending run. A dispatched rehearsal is grouped by its commit, so dispatches for two commits do not cancel each other at the top level; the called build workflows' dry-run groups name only the calling workflow, so two rehearsals still run each build one at a time.

Why

Part of #1395. Release tags are protected, so a failure after the tag that needs a code change costs a version. Once merging the release PR creates the tag, the rehearsal has to run on the PR, and the merge queue must merge the tree that was rehearsed. The rehearsal now covers the crates.io package step too, so the merge, which publishes after #1469, needs no local step first.

Testing done

  • A probe of a work-in-progress version of this change, on a temporary branch, ran the rehearsal through workflow_call from a push-triggered caller and passed every gate and build, with every publish job skipped: https://github.com/ExtendDB/extenddb/actions/runs/45515054457. That version did not yet have the repository check, the release PR head check, the per-image artifact names or release-pr.yml. On this stack, the release-pr check has run only in its other-PR mode (run 46828564831); its release-PR and merge-queue modes and the rehearsal have not run yet. The first push to the release PR's branch is their first real run.
  • Every run: block extracted verbatim and tested: the release-pr decision for each event on real main commits and simulated release branches, including an entry queued behind the release PR; the polling logic with a fake gh (cancelled runs, reruns, API errors, both time limits); the gate's commit input (a commit on main, the release PR head, a fork PR head, a random SHA).
  • resolve-release-commit's script against origin, as the gates and the rehearsal's target call it: v1.1.0 resolves to its commit and version; a missing tag, a malformed tag, a commit without dry_run, a short SHA, a SHA not on origin, and a commit that is neither on main nor the release PR's head (a fork PR's head among them) are refused.
  • The branch-shape step, extracted, on scratch branches: release-please's commit alone, and with a second commit that changes Cargo.lock, pass. Refused: a second commit that changes a file not in .github/release-pr-files.txt; a main without that list; a release-please commit that changes a file release-please-config.json does not list, or adds the file to the config in the same commit.
  • actionlint and devtools/check-actions-pinned are clean.

Setup (admin)

  • When this merges: make release-pr a required check on main (GitHub Actions app). A PR that was open before this merged gets the check on its next push. Until RELEASE_APP_CLIENT_ID is set, a queue entry that changes the manifest passes, so releases by hand work as before.
  • Keep the merge-queue setting "Only merge non-failing pull requests" on (ALLGREEN today); the queue rule depends on it.
  • When the release PR is switched on (ci(release): keep a release PR open with release-please #1467's setup, step 3): a branch ruleset on release-please--branches--main--components--extenddb (restrict creations, updates and deletions; no force-push rule; the App as the only bypass actor), so only the App pushes to the release PR's branch. release-pr checks the commits' authors and files, which a push by hand could imitate.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace): not run, no Rust change
  • Code is formatted (cargo fmt --check): no Rust change
  • Clippy is clean (cargo clippy -- -W clippy::pedantic): no Rust change
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a: CI and release tooling only; the design is discussed in #1395

Breaking changes

None. A dispatch of a build workflow behaves as before; the artifact names inside a run change.


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

@robinnsc robinnsc self-assigned this Nov 25, 2026
@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from d093ec4 to 01fdd5f Compare November 29, 2026 01:33
@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from 01fdd5f to dfc3777 Compare November 30, 2026 21:56
@robinnsc
robinnsc marked this pull request as ready for review November 30, 2026 21:56
@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from dfc3777 to 4749ab9 Compare December 1, 2026 18:55
@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from 4749ab9 to 518a86d Compare December 2, 2026 06:56

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks. I read the change against #1467's head d632afb. actionlint 1.7.12 finds nothing in the five workflows at this head or at #1467's head. On this head the release-pr check ran in its other-PR mode and passed (run 46828564831).

The rehearsal publishes nothing. In release-image.yml, release-dev-image.yml and npm-publish.yml, every job that pushes, signs, attests or publishes needs publish-candidate or publish. Those two run only when dry_run is false and commit is empty. The rehearsal always passes dry_run: true, and each gate refuses a commit without dry_run. release-pr.yml runs on pull_request and merge_group with a read token, and each event value reaches a run: block through env:.

Small points, none of them a condition:

  • Lines 224-244 of release-image.yml, the gate for the commit input, appear word for word in release-dev-image.yml (lines 146-166) and in npm-publish.yml (lines 169-189). A composite action would leave one copy. If the three copies stay, please say why in the description.
  • release-pr.yml:185-189 repeats the list of files that push-release-pr in release.yml may change (lines 390-394). If one list changes without the other, the release PR fails its own check. If both read one file or run one script, the list exists once.
  • release-rehearsal.yml:59 puts each dispatched rehearsal in the group release-rehearsal-refs/heads/main, so two dispatches for different commits cancel each other. With inputs.commit in the group, the push case stays as it is.
  • Testing done says that this head has not run on GitHub. The release-pr check did run on it, in its other-PR mode. Its release-PR mode, its merge-queue mode and the rehearsal have not run yet.

I found no other open PR that adds a rehearsal or a release PR check. #458 changes npm-publish.yml too, and the two PRs conflict there in five hunks. My review of #1469 covers that overlap.

@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from 518a86d to ae11e38 Compare December 3, 2026 09:59
@robinnsc

robinnsc commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author
  1. The rule moved into a composite action, .github/actions/resolve-release-commit, which the three gates call before their tag step. Its script, run locally against origin: v1.1.0 resolves to 222d80a; a missing tag, a malformed tag, a commit without dry_run, and a commit that is neither on main nor the release PR's head are refused; a commit on main with dry_run resolves to itself.
  2. The list is now one file, .github/release-pr-files.txt, which both read. push-release-pr reads it from the commit before git apply, so a patch cannot add to it, and its content check now refuses a changed file that it has no check for, so a path added to the list without a check fails closed. release-pr.yml reads it from release-please's commit, which may change only the version files.
  3. A dispatched rehearsal's group now ends with its commit, so dispatches for two commits no longer cancel each other at the top level; push runs keep one group per branch. The called build workflows' dry-run groups name only the calling workflow, so two rehearsals still run each build one at a time, and a third replaces the second's pending called run. The header of release-rehearsal.yml says so.
  4. Testing done now says that the release-pr check ran in its other-PR mode, and that its release-PR and merge-queue modes and the rehearsal have not run yet.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve again. You fixed the four notes from my last review.

  • resolve-release-commit holds the commit gate once, and the three gates call it before their tag step. Its script gave the result your answer lists for each case. It also refused a short or uppercase SHA and a SHA that is not on origin.
  • .github/release-pr-files.txt is the one list. A patch that adds to it, a listed file with no content check, and a release-please commit that changes it are each refused.
  • Two dispatched rehearsals for different commits now use different concurrency groups.
  • Testing done now lists the checks that ran.

The rehearsal still publishes nothing, and actionlint, check-actions-pinned and shellcheck are clean. One small point inline, not a condition.

CI passed at this head, 67 of 67.

Comment thread .github/workflows/release-image.yml Outdated

# 1. Strict shape first: anything else cannot be a release tag and
# must not reach git commands as a ref expression.
# resolve-release-commit has checked it; VERSION comes from it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

resolve-release-commit refuses a tag that is not vMAJOR.MINOR.PATCH before this step runs, so the check below can no longer fail. The same check stays in release-dev-image.yml (line 147) and npm-publish.yml (line 172), and the action holds a fourth copy. The action could output the version next to the SHA, and the three gates could read VERSION from it and drop their checks. If the copies stay, please say why in the description. Not a condition.

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.

resolve-release-commit now outputs version next to sha, and the three gates read VERSION from it and no longer check the tag's shape, so the action holds the only copy. The rehearsal's target job now calls it too, before any job checks the commit out: on a dispatch, crates built inputs.commit unchecked, so a commit GitHub serves by SHA, a fork PR's head included, could run in a job of a run on main. Fixed in d1b0654.

@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from ae11e38 to d1b0654 Compare December 3, 2026 11:18

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve again at d1b0654. resolve-release-commit now outputs the version, and the three gates read it, so the action holds the only tag check.

The rehearsal's target job now checks a dispatched commit with the same action before the crates job builds it. Before, a dispatch's commit reached crates unchecked. I ran the action's script against a scratch copy of the repository. It gave the SHA and the version for a release tag, for a commit on main and for the release PR's head. It refused another commit, a commit without dry_run, a malformed tag and a missing tag.

actionlint, check-actions-pinned and shellcheck are clean. CI passed at this head, 67 of 67.

Release tags are protected, so a failure after the tag that needs a
code change costs a version. With the release PR the merge creates the
tag, so the rehearsal has to run on the PR, and the merge queue must
merge the tree that was rehearsed. This adds release-rehearsal.yml,
which dry-runs the build workflows on each push to the release PR's
branch, and release-pr.yml with the check `release-pr`, which the admin
makes required on main. On any other PR it checks only that the
manifest and Cargo.toml name one version.

release-image, release-dev-image and npm-publish get a workflow_call
trigger with their dispatch inputs and a commit input. With dry_run and
a commit, the gate rehearses that commit before it is tagged: it skips
the tag checks (and npm-publish its check of package.json on main) and
keeps the version checks against the tag the commit will get. The gate
refuses a commit without dry_run or one that is neither on main nor the
release PR's head, and the publish jobs also require an empty commit.
The three gates resolve the commit with one composite action,
.github/actions/resolve-release-commit, which holds the tag and commit
rules that each gate had a copy of, and outputs the commit and the
version, so the gates no longer check the tag's shape themselves.
Any public repository can call a reusable workflow, and the called
run's certificate names the called file, so each gate's first step
refuses to run outside ExtendDB/extenddb. The image and SBOM artifacts
are named after the image, so the calls in one run never share an
artifact name, and npm-publish downloads only its own binaries.

release-rehearsal.yml runs on push to the release-please branch and on
workflow_dispatch from main. It calls release-image per backend image,
release-dev-image and npm-publish with dry_run on the pushed commit and
the manifest's version. Its target job checks the commit with
resolve-release-commit before any job checks it out, because the crates
job builds it: without that, a dispatch could build any commit GitHub
serves by SHA, a fork PR's head included, in a run on main. A newer
push cancels the older run; a
dispatched rehearsal is grouped by its commit, so dispatches for two
commits do not cancel each other at the top level. The called
workflows' dry-run groups name only the calling workflow, so two
rehearsals still run each build one at a time. It never runs on
pull_request, so a fork PR never starts it. The image calls
grant id-token, packages and attestations write and the npm call
id-token write, because a caller must grant what a called job asks
for, even a skipped one. Its crates job runs release-crates.yml's plan
and verify steps (devtools/publish-crates --dry-run, cargo package
--workspace --locked on the release's toolchain, and
devtools/check-crate-packages). A dry run of a called workflow takes a
concurrency group named after the calling workflow, so a rehearsal and
a dispatched dry run do not replace each other's pending run.

release-pr.yml has contents and actions read. On the release PR it
checks that the three manifests name one version, that cargo metadata
--locked and devtools/check-released-through pass, and that the branch
holds only release-please's commit, which may change only the manifest
and the files release-please-config.json on main lists, and at most
push-release-pr's commit, which may change only the files in
.github/release-pr-files.txt, the list push-release-pr reads. Then it
waits up to 90 minutes for the rehearsal run on the PR's head and passes
only if that run succeeded. On a merge queue entry whose own change
(head against its first parent) touches the manifest, it passes only
when the entry's tree is the release PR head's tree. A PR queued ahead
of the release PR makes the trees differ, the queue drops the release
PR, and the release workflow run of the next push to main rebuilds it.
This relies on the queue setting "Only merge non-failing pull requests",
which is on. Until the release automation is on (RELEASE_APP_CLIENT_ID
set), an entry that changes the manifest and is not the release PR
passes, so releases by hand work as today. On every other PR and queue
entry it checks that the manifest and Cargo.toml name one version, so a
version change by hand cannot leave the manifest behind.

The commit check reads authors and files, which a push by hand could
imitate. packaging/README.md's setup adds a branch ruleset that lets
only the App push to the release PR's branch.

Before this takes effect, the admin makes `release-pr` required. A PR
that was open before this merged gets the check on its next push.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
@robinnsc
robinnsc force-pushed the ci/release-callable-workflows branch from d1b0654 to 6d3f8a7 Compare December 3, 2026 22:12
@robinnsc

robinnsc commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

Changes in 6d3f8a7, restacked on #1467's c9d56f6:

  1. release-pr.yml's check of release-please's commit reads its file list from release-please-config.json on the commit's parent, the same list prepare-release-pr reads in ci(release): keep a release PR open with release-please #1467, in place of its own case list. Tested on scratch branches: an unlisted file, and a config entry added in the same commit, are refused.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve again at 6d3f8a7. The check of release-please's commit now reads its file list from release-please-config.json on the commit's parent, in place of its own case list. That is the list prepare-release-pr reads in #1467. On the config at #1467's head, the list holds the same six files as the old list. When the parent has no config, the step stops with "lists no extra-files", so a missing config fails closed. actionlint and shellcheck are clean.

CI on 6d3f8a7: 67 checks passed. One run of the PR title check was cancelled when a second run started, and the second run passed.

This branch has not been deployed

No deployments
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.

2 participants