Files
cozystack/docs/release/regular-releases.md
T
Marian Koreniuk e89821ca2e ci(release): refuse a Promote RC dispatch from any ref but main
A workflow_dispatch runs the copy of promote-rc.yaml at the ref it was
dispatched from. On 2026-10-16 a dispatch from release-1.6 ran that
branch's older copy, one job instead of five, and had to be re-run from
main. Since the release assets are signed, the same dispatch would now
fail at the upload step, after the staging branch, the promotion-*
candidate and the draft release already exist, and
docs/release/signatures-and-sbom.md pins the signature identity to this
workflow on main.

Make the first step of parse compare github.ref with refs/heads/main and
fail with an error that names main, so a dispatch from a release branch,
a tag or a SHA stops before the first write. The bats test runs the
step's shell under dash for main, a release branch, a tag and an empty
ref, and pins the step to be the first one in parse.

The release docs tell the operator to dispatch from main and state that
only a copy carrying the check refuses other refs: older release-X.Y
copies stay callable and still write before stopping.

Assisted-by: LLM
Signed-off-by: Marian Koreniuk <moriarti@cp.if.ua>
2026-11-27 19:14:10 +01:00

9.8 KiB

Regular Releases

A regular release vX.Y.0 is promoted from a release-candidate that already passed e2e — never tagged by hand and never rebuilt. The bytes shipped as vX.Y.0 are the exact vX.Y.0-rc.N images, retagged by digest. We'll use v1.2.0 as an example.

gitGraph
    commit id: "feature"
    commit id: "feature 2"
    commit id: "feature 3" tag: "v1.2.0-rc.1"

A regular release sequence runs as follows:

  1. Cut the first release candidate (v1.2.0-rc.1) from the last good commit on main: run the Cut Pre-release Tag workflow (manual dispatch from main) with the tag. It tags main's HEAD as the CI app, then creates release-1.2 at that commit, freezing the line; tags.yaml then builds the rc images, publishes the rc prerelease, pushes the digest-vendored release-1.2.0-rc.N staging branch, and runs its mandatory rc-e2e job by calling e2e-tag.yaml against that published tag.

  2. Watch the rc's mandatory full E2E and wait for it to pass, then complete the other checks in Pre-release verification checklist. If the latest tags.yaml run cannot provide a green rc-e2e, a successful manual dispatch of e2e-tag.yaml for the same tag is equivalent gate evidence. main is already open for the next minor, so anything landing there is not in this release until it reaches release-1.2: a fix merged into main gets there through the backport batch, which runs for release-1.2 from the freeze on, and a fix with no counterpart on main through a maintainer's pull request against release-1.2. A later rc is cut by dispatching the workflow from release-1.2, and only once ./backport-batch check --line release-1.2 --cut exits 0: merge the open batch pull request first, so that the rc carries every fix the policy takes. Optional: once the notes are worth reviewing, press the Generate RC Changelog button (changelog-rc.yaml) to generate docs/changelogs/v1.2.0.md now and bank it on the release-1.2.0-rc.N staging branch — so there is time to review and hand-edit it before promotion. Skipping the button changes nothing; promotion generates the changelog itself.

    gitGraph
        commit id: "feature"
        commit id: "feature 2"
        commit id: "feature 3" tag: "v1.2.0-rc.1"
        branch release-1.2
        checkout main
        commit id: "feature 4 (next minor)"
        checkout release-1.2
        commit id: "backported fix" tag: "v1.2.0-rc.2"
    
  3. Once the checks are green, run the promote-rc.yaml workflow (manual dispatch from main, the only branch it is dispatched from, whichever line the rc belongs to) with that rc tag. A dispatch runs the copy of the workflow at the selected ref: only a copy that carries the ref check, as main does, refuses any other ref in its parse job before anything is written. Older copies on existing release-X.Y branches remain callable, have no such check, and still push the staging branch and create the draft release before anything stops them, so never pick a release branch as the dispatch ref. Its parse job verifies E2E before any staging: it accepts a successful rc-e2e job in the latest tags.yaml push run for the tag, or any retained successful manual e2e-tag.yaml run whose expanded E2E job name targets the tag. The emergency skip_e2e_gate input bypasses this check, logs a loud warning, and marks the promote PR with ⚠️. Before its first registry write, promotion also proves that the selected main or release-X.Y target already contains the candidate-aware PR gate, finalizer and trusted verifier. A maintenance branch that lacks them gets them before its next patch is promoted, through the batch with backport/include on the pull request that brought them to main, or through a maintainer's pull request against the line. Promotion creates no stable name before merge: dispatch does write to the registry — it publishes one promotion-* packages candidate, and that tag is real and publicly listable — but it creates no vX.Y.Z tag, moves no latest, and publishes no stable installer, so nothing a consumer resolves changes until the PR merges. It:

    1. Rewrites the rc version substring to 1.2.0 and commits that exact tree, serializes its packages/ directory under a run-specific temporary OCI tag, then adds a second commit pinning the candidate's immutable digest in the installer before pushing release-1.2.0. Container digests remain exactly the rc's; the two commits give the OCI revision an honest source SHA without pretending the artifact can contain its own digest.
    2. Drafts the v1.2.0 release and uploads the (restamped) assets.
    3. Generates docs/changelogs/v1.2.0.md (in a parallel job, detached at the rc tag) — or, if you pressed the rc-time Generate RC Changelog button, copies the file already banked on the release-1.2.0-rc.N staging branch instead of regenerating — and commits it onto the release-1.2.0 branch, so the changelog is reviewed as part of the promotion and finalize can publish the release with it already in place. Non-blocking: if generation fails the PR still opens, carrying a ⚠️ line that says the changelog is missing.
    4. Opens the cozystack/website "update managed apps reference" PR (update-docs-v1.2.0 branch), generating the docs from the release-1.2.0 staging branch via FETCH_REF. Non-blocking, and do not merge that PR until v1.2.0 is published — merging early breaks the live site's version routing (see Phase 3).
    5. Opens the chore(release): promote v1.2.0-rc.N -> v1.2.0 PR into release-1.2, labelled release only. The PR body records whether E2E was verified or bypassed, plus ✅/⚠️ changelog and website-docs lines. E2E does not run on this promote PR by default because the immutable rc already passed the mandatory full suite; a maintainer may add full-e2e to run it again. The stable retag itself is deferred to the merge (step 5), so an abandoned promotion leaves no stable-named images and cannot wedge a re-promotion; retention protects the temporary candidate for as long as this release PR remains open, then may remove it after 30 days.

    The PR targets the maintenance branch, not main: promote-rc.yaml prefers release-X.Y whenever it exists, and since the rc freeze it always does. The digest-vendored Prepare release commit therefore stays on the release line instead of landing on main.

    gitGraph
        commit id: "feature 3" tag: "v1.2.0-rc.1"
        branch release-1.2
        checkout release-1.2
        commit id: "backported fix" tag: "v1.2.0-rc.2"
        branch release-1.2.0
        checkout release-1.2.0
        commit id: "Prepare release v1.2.0"
        commit id: "Pin promoted packages artifact"
        checkout release-1.2
        merge release-1.2.0 id: "Pull Request"
    
  4. Maintainer reviews the PR and the draft release against the Phase 4 checklist: confirm the E2E-verification line is ✅ (or explicitly accept its ⚠️ bypass), the changelog line is ✅, and note the website-docs line — the cozystack/website docs PR that promotion parked, which stays unmerged for now. E2E does not run on this promote PR by default. Then merge — do not squash-merge, the stable tag must attach to a real merge commit. GitHub removes the merged branch release-1.2.0 (the repo has auto-delete-on-merge enabled).

  5. CI workflow triggers on merge (this is where every consumer-visible or write-once side effect happens, after the rc E2E gate and PR review):

    1. Pulls the pinned packages candidate by digest and verifies that it matches the merged packages/ tree apart from the artifact's impossible self-reference, carries no rc image tags, and preserves the original rc artifact's container repo@digest set.
    2. Creates the tag v1.2.0 at the newly created merge commit — write-once. The tag is published here for the first time, never moved.
    3. Cuts the write-once api/apps/v1alpha1/v1.2.0 Go-module tag at the same commit.
    4. Ensures the release-1.2 maintenance branch exists at the tag commit. Since the rc freeze created it, this is normally a no-op fast-forward: the merge commit is already its tip.
    5. Retags the verified packages candidate and rc container images by digest to v1.2.0 (and :latest only when v1.2.0 is the newest published stable), and publishes the stable cozy-installer chart — no container rebuild.
    6. Publishes the release page (draft → latest), using docs/changelogs/v1.2.0.md from the merge commit as the release body. It goes last, so the page never announces a version whose images and chart are not in the registry yet.
  6. Once the release is published, merge the parked cozystack/website docs PR (opened back at promote time, step 3.iv) so the live site's version routing flips to v1.2.0 — its versioned docs and openapi.json are on GitHub now. The maintainer can then announce the release to the community.

gitGraph
    commit id: "feature 2"
    commit id: "feature 3" tag: "v1.2.0-rc.1"
    branch release-1.2
    checkout main
    commit id: "feature 4 (next minor)"
    checkout release-1.2
    commit id: "backported fix" tag: "v1.2.0-rc.2"
    branch release-1.2.0
    checkout release-1.2.0
    commit id: "Prepare release v1.2.0"
    checkout release-1.2
    merge release-1.2.0 id: "Release v1.2.0" tag: "v1.2.0"

Note that main never receives the release commit. It forked away at the freeze and carries the next minor's work.