release-gate action (release + promote modes) with fixture tests #2

Closed
opened 2026-11-10 22:22:58 +01:00 by robin.wieske · 0 comments
Owner

Context

release-gate decides when a draft is published (mode: release) and which tag is promoted to prod (mode: promote). It is the core of the rollout; every repo pins it by commit SHA.

Plan: https://forgejo.entwirr.me/Wi3eDigital/laravel-deploy-actions/src/branch/main/docs/plan.md (sections "Release rules" and "Promote rules").

Tasks

  • Python composite action release-gate/ (Forgejo API only, no extra services)
  • Inputs: mode (release | promote), token, repo, dry-run, thresholds (SOAK_DAYS=4, DEPS_THRESHOLD=10, DEPS_MAX_AGE_DAYS=14), prod URL
  • Outputs: publish, candidate, critical, reasons, skip_reason
  • mode: release: re-run the drafter first, then apply the release rules
  • mode: promote: pick the candidate, then apply the promote rules
  • Irreversible migration detection: dropColumn, dropTable, renameColumn, dropIfExists on an existing table, in migrations added since the version prod runs
  • New .env key detection since the version prod runs; skip when the release body contains <!-- env-acknowledged -->
  • kima/kima: read .release/requires.json and compare with portal prod /version
  • Dry-run: compute everything, log the decision, change nothing
  • Fixture tests against recorded Forgejo API responses (no network in tests), one fixture set per rule
  • README with inputs, outputs and an example step

Acceptance criteria

Release mode publishes only if all hold:

  • AUTOMATION_PAUSED is not true and AUTO_RELEASE is on (dry-run reports only)
  • Exactly one draft with a strict vX.Y.Z tag exists
  • The draft is not empty
  • At least one non-dependency PR (not dependency label, not chore(deps) title), or a dependency PR labelled security, or at least 10 dependency PRs, or the oldest unreleased dependency PR is older than 14 days
  • critical=true with reasons for: label security, breaking-change or caution; a major dependency update; new migrations; new .env keys

Promote mode:

  • Candidate is the newest release with deploy/staging = success and at least SOAK_DAYS old
  • A failed staging deploy of a newer tag does not block an older soaked candidate; a failed staging deploy of the candidate does
  • AUTOMATION_PAUSED is not true and AUTO_PROMOTE is on
  • Live prod /version is older than the candidate (semver); equal or newer gives skip_reason, not an error
  • No open issue labelled release-blocker
  • No new .env keys since prod's version unless the release body has <!-- env-acknowledged -->
  • No irreversible migration since prod's version
  • Critical release: commit status notify/pre-prod = success at least 24h old
  • kima/kima: portal prod /version >= version in .release/requires.json
  • /version accepted as plain text or {"version": "vX.Y.Z"}
  • Every rule has a passing and a failing fixture test; tests run in CI of this repo

Blocked by

Nothing. Starts after the plan PR #1 is merged.

## Context `release-gate` decides when a draft is published (`mode: release`) and which tag is promoted to prod (`mode: promote`). It is the core of the rollout; every repo pins it by commit SHA. Plan: https://forgejo.entwirr.me/Wi3eDigital/laravel-deploy-actions/src/branch/main/docs/plan.md (sections "Release rules" and "Promote rules"). ## Tasks - [ ] Python composite action `release-gate/` (Forgejo API only, no extra services) - [ ] Inputs: `mode` (`release` | `promote`), token, repo, `dry-run`, thresholds (`SOAK_DAYS`=4, `DEPS_THRESHOLD`=10, `DEPS_MAX_AGE_DAYS`=14), prod URL - [ ] Outputs: `publish`, `candidate`, `critical`, `reasons`, `skip_reason` - [ ] `mode: release`: re-run the drafter first, then apply the release rules - [ ] `mode: promote`: pick the candidate, then apply the promote rules - [ ] Irreversible migration detection: `dropColumn`, `dropTable`, `renameColumn`, `dropIfExists` on an existing table, in migrations added since the version prod runs - [ ] New `.env` key detection since the version prod runs; skip when the release body contains `<!-- env-acknowledged -->` - [ ] kima/kima: read `.release/requires.json` and compare with portal prod `/version` - [ ] Dry-run: compute everything, log the decision, change nothing - [ ] Fixture tests against recorded Forgejo API responses (no network in tests), one fixture set per rule - [ ] README with inputs, outputs and an example step ## Acceptance criteria Release mode publishes only if all hold: - [ ] `AUTOMATION_PAUSED` is not `true` and `AUTO_RELEASE` is `on` (`dry-run` reports only) - [ ] Exactly one draft with a strict `vX.Y.Z` tag exists - [ ] The draft is not empty - [ ] At least one non-dependency PR (not `dependency` label, not `chore(deps)` title), or a dependency PR labelled `security`, or at least 10 dependency PRs, or the oldest unreleased dependency PR is older than 14 days - [ ] `critical=true` with reasons for: label `security`, `breaking-change` or `caution`; a major dependency update; new migrations; new `.env` keys Promote mode: - [ ] Candidate is the newest release with `deploy/staging` = `success` and at least `SOAK_DAYS` old - [ ] A failed staging deploy of a newer tag does not block an older soaked candidate; a failed staging deploy of the candidate does - [ ] `AUTOMATION_PAUSED` is not `true` and `AUTO_PROMOTE` is `on` - [ ] Live prod `/version` is older than the candidate (semver); equal or newer gives `skip_reason`, not an error - [ ] No open issue labelled `release-blocker` - [ ] No new `.env` keys since prod's version unless the release body has `<!-- env-acknowledged -->` - [ ] No irreversible migration since prod's version - [ ] Critical release: commit status `notify/pre-prod` = `success` at least 24h old - [ ] kima/kima: portal prod `/version` >= version in `.release/requires.json` - [ ] `/version` accepted as plain text or `{"version": "vX.Y.Z"}` - [ ] Every rule has a passing and a failing fixture test; tests run in CI of this repo ## Blocked by Nothing. Starts after the plan PR https://forgejo.entwirr.me/Wi3eDigital/laravel-deploy-actions/pulls/1 is merged.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
You do not have permission to read 4 dependencies
Reference
Wi3eDigital/laravel-deploy-actions#2
No description provided.