Skip to content

A release checks its owner-granted prerequisites first, builds each architecture natively, and can be rehearsed with a dry run - #316

Merged
zlareb1 merged 20 commits into
mainfrom
ci/release-dry-run
Nov 7, 2026
Merged

zlareb1 merged 20 commits into
mainfrom
ci/release-dry-run

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

...

Why

No release run has completed. All three tag runs failed in the server image's push after 35 to 50 minutes of building, with denied: permission_denied: read_package: the organization's ghcr.io/clickhouse/loom package does not give this repository Write access. Nothing in the workflow checked that before the builds, nothing could rehearse a release without a tag, and most of each run's hour was the arm64 build under QEMU.

This change makes a release fail in seconds on a missing prerequisite, lets a maintainer rehearse the whole release on any branch, and builds each architecture natively.

  • preflight job (scripts/release/preflight.sh), after version and before any build. It checks what only an owner can grant: the repository is public, this workflow can push to both ghcr.io packages (it opens a blob upload session and cancels it, so nothing is written), and anyone can pull both (an anonymous pull token, which ghcr.io gives only for a public package). Each missing prerequisite is named with the setting that fixes it. A release fails on any of them. A dry run reports them as warnings. A release from a private repository is refused, because every publish is public and a PyPI version can never be reused.
  • dry_run dispatch input. gh workflow run release.yml --ref <branch> -f dry_run=true runs version (at the version server/__init__.py names), preflight, clickhouse, build, verify, docker and docker-smoke. It skips docker-tag, github-release, pypi, npm and mcp-registry, and the docker job neither logs in nor pushes. Its images are exported to run artifacts (one-day retention) instead of pushed, and docker-smoke loads them, so the smoke tests run against this run's own builds. A registry keeps provenance and SBOM attestations, but a file does not, so a dry run's images have none.
  • Native per-architecture builds. The docker matrix is image × architecture: amd64 on ubuntu-latest, arm64 on ubuntu-24.04-arm, with no QEMU, and no build cache (below). Each entry pushes its own digest and scans it. docker-tag joins each image's two digests into one index under the version tags, and still tags nothing until all four scans have passed. The digest it reports for the chart's image.digest is the index's.
  • Latest follows the highest final version. GitHub's releases/latest serves the one-line installer and :latest serves the image. Before this change, whichever release ran last took both, including a patch to an older line. scripts/release/make_latest.py decides from the repository's v* tags, which exist from the push on, before a release run publishes anything. It asks at the moment Latest is applied: in docker-tag for :latest, and in github-release for the release's make_latest. So a "Re-run failed jobs" after a newer tag shipped never moves Latest back, and two tags released together agree. metadata-action's own latest=auto is switched off (flavor: latest=false), since it would tag any final version :latest. A failed tag listing fails the step.

The mcp-registry job's private-repository skip is removed: preflight now stops a release from a private repository before any build.

Scope and risk

Only the release workflow, its scripts and its documentation change. The tag path is not exercised until the first real release. On that path, the per-architecture split, the index join, metadata-action's flavor and value= inputs, make_latest on the GitHub Release, and the :latest decision are new. The join is the documented multi-runner pattern for buildx imagetools create, and a unit test runs the tag step against four scans and a stub docker. Release images now build without the build cache. A docker-smoke scan found libbrotli1 1.1.0-2+b7 (CVE-2026-111497, critical, fixed in +deb13u1) in an image whose apt layer came from the GitHub Actions cache, hours after a cold dry run had passed. A cached apt layer either fails the release's scan on a package fixed since it was cached, or ships that package when the scanner's database lags. The uncached native builds took about 4 minutes for the server image (3m58s on arm64, 4m22s on amd64) and about 1 minute for the extractor in dry run 42320732996.

Because a rebuild now produces other bytes, a run on a tag whose two images already carry the version builds and tags none. That covers the registry dispatch after the tag run, and any later dispatch. preflight asks ghcr.io, signed in to nothing, through scripts/release/published_images.sh. Any answer but "there" or "not there" fails the step, so an outage never reads as "rebuild". docker and docker-tag are then skipped, docker-smoke tests the published images, and github-release accepts the skipped docker-tag.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none. The owner prerequisites the preflight checks are listed in the release process page's new "Before the first release" section.
  • Rollback: reverting restores the emulated single-job build. No stored state.

Tests

  • tests/unit/test_release_preflight.py runs the preflight against a stub ghcr.io in each state:

    • ready;
    • a private repository, an unwritable package and private packages;
    • a package never pushed, which warns instead of failing;
    • dry-run warnings;
    • no push token.

    It also checks that the upload session is cancelled. It covers make_latest.py on a patch to an older line, prereleases and numeric order, and on a failed tag listing, which fails the script. And it covers the wiring: the preflight before any build, Latest asked in both jobs that apply it, flavor: latest=false, fail-fast off in a dry run, no publish in a dry run, and the dry-run smoke loading the images under the names it runs.

  • tests/unit/test_release_job_paths.py works out which jobs run from release.yml's own if: expressions. It applies GitHub's rules: an if naming no status function also needs every upstream job to succeed, and needs.X is defined only for a direct need. The paths are the tag push (with the images not yet out, and already out), the registry dispatch on the published tag (no image built or tagged, every registry published), a dispatch on an unpublished tag, a prerelease dispatch (no MCP Registry listing), a dry run, and failures in verify, the docker jobs, the smoke and the GitHub Release, none of which publishes anything after it. Only a published release runs these paths for real.

  • tests/unit/test_docker_quickstart_smoke.py runs the tag step against four scans. It checks that two digests are joined per image, that :latest is added only when asked, that the index digest is reported, and that a missing scan is refused before anything is tagged.

  • The preflight's answers were read from ghcr.io itself. An anonymous pull-token request answers 200 for a public package, 401 for a private one and 403 for one never pushed. An upload session is refused with 403 to a token without package write.

  • actionlint 1.7.7 on release.yml is clean.

  • Dry run of the first push, run 42303820510. The preflight named exactly what failed the three tag runs, as four warnings:

    • the repository is private;
    • ghcr.io/clickhouse/loom refuses this workflow's push (403);
    • loom-extractor, the package this repository created, accepts it;
    • both packages are private.

    The server image's scan then failed on two critical CVEs in the Dockerfile's Go and Node pins, which no tag run had reached. A separate change of the Dockerfile's pins fixes them.

  • Dry run of an earlier head merged with the Dockerfile pin fix, run 42308447768: green. All four native image builds were scanned, and both quickstart smokes ran against the run's own exported images. docker-tag, github-release, pypi, npm and mcp-registry were skipped.

  • Dry run of the uncached builds merged with the Dockerfile pin fix, run 42320732996: green, with the same jobs run and skipped.

  • scripts/release/published_images.sh against ghcr.io itself answers as expected: true for a public image's existing tag, false for a missing tag, false for a package never pushed, and a failure for a private package. A unit test covers it against a stub registry: an outage fails the step, one image out without the other fails with its recovery, and an image built from another commit (a moved tag) fails.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. The preflight's registry answers were checked against ghcr.io, and the dry run was read job by job.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: none are affected.
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version: none.
  • The frontend builds, if frontend/ changed: unchanged.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

zlareb1 and others added 20 commits November 7, 2026 08:07
…rchitecture natively, and can be rehearsed with a dry run

Every release run so far failed at the server image's push after 35-50 minutes. A preflight job now checks repository visibility and ghcr.io push and pull access in seconds; a dry_run dispatch input runs every build, check and smoke test on any branch and publishes nothing; the docker matrix builds amd64 and arm64 on their own runners; only the highest final version becomes Latest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… fails closed, and a package never pushed warns

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…re-run never moves it back

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…an empty pin, and the docs follow

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ng inspect

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…d tag listing says why

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…hives as they are that day

A docker-smoke scan found libbrotli1 1.1.0-2+b7 (CVE-2026-111497, critical, fixed in +deb13u1) in an image whose apt layer came from the build cache, after a release dry run without that cache had passed. A cached apt layer either fails the release's scan on a package fixed since, or ships it if the scanner's database lags. The preflight's package link names the settings page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
With release images built without the cache, the registry dispatch on a released tag would have rebuilt both images and moved the version's tags onto other bytes. preflight now asks ghcr.io, signed in to nothing, whether both images carry the version (scripts/release/published_images.sh, failing on any answer but there or not there); docker and docker-tag then skip, docker-smoke tests the published images, and the GitHub Release step accepts the skip. The docs say what a dry run does not exercise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ge jobs, and published images must come from the run's commit

A publish job's implicit success() read the docker jobs a dispatch on a published tag skips, so PyPI, npm and the MCP Registry would never have published; each now runs on !cancelled() and the GitHub Release's success. published_images.sh reads the published image's revision label and fails when it is another commit, so a moved tag cannot ship old images beside new files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…n conditions, and a half-tagged version fails with its recovery

tests/unit/test_release_job_paths.py evaluates release.yml's if: expressions, with GitHub's implicit success() over every upstream job, for the tag push, the registry dispatch on the published tag, a prerelease, a dry run and failures. published_images.sh fails when only some images carry the version, naming the re-run that tags the same build; the preflight names a missing push token apart from a missing grant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…lished images and failures on it are covered

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… feeds both checks, and the published-tag smoke waits for verify

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ags a release carries; the registries rely on github-release for the dry run

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… as GitHub behaves, and one no-token test

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…s sit together

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the ci/release-dry-run branch from b6bd532 to 16b43d9 Compare November 7, 2026 08:22
@zlareb1
zlareb1 merged commit 185efbc into main Nov 7, 2026
28 checks passed
@zlareb1
zlareb1 deleted the ci/release-dry-run branch November 7, 2026 08:49
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