Validate version against VERSION.md and notify automation repo#1143
Draft
tomleb wants to merge 1 commit intorancher:mainfrom
Draft
Validate version against VERSION.md and notify automation repo#1143tomleb wants to merge 1 commit intorancher:mainfrom
tomleb wants to merge 1 commit intorancher:mainfrom
Conversation
Replaces the existing tag-push-triggered release workflow with a validated `workflow_dispatch` flow. The new workflow is the only path that should produce a tag — engineers no longer run `git tag` locally.
The motivation: today it's easy to tag the wrong version on the wrong branch (e.g. `v0.9.x` from `release/v0.7`), and there's no signal to downstream repos that a release happened. The new workflow validates everything before tagging and notifies the central `rancher/release-automation` repo so the rancher bump PR can open within ~30s.
Trigger from **Actions → Release → Run workflow**. Pick the branch (e.g. `main` or `release/v0.7`) and enter the version (e.g. `v0.9.6`). The workflow then:
1. **Validates the version**:
- Format `v<major>.<minor>.<patch>[-prerelease]`.
- The minor matches what `VERSION.md` says this branch is allowed to release (e.g. `release/v0.7` → `v0.7.x`).
- Next-sequential against the latest existing tag on that minor line (no skipping `v0.7.5 → v0.7.7`).
- Tag doesn't already exist.
- The required CI workflows (`CI`, `Integration tests`) are green on the head SHA.
2. **Creates the annotated tag** on the head SHA and pushes it.
3. **Creates the GitHub Release** with auto-generated notes (same as the previous workflow).
4. **Notifies the `rancher/release-automation` repo** via `repository_dispatch` so the reconciler opens the rancher bump PR.
`permissions: {}` is set at the workflow level so each job runs with only the perms it needs (`validate`: read-only; `release`: `contents:write`).
- [ ] **Add repo secret `AUTOMATION_DISPATCH_TOKEN`**: a fine-scoped PAT (or GitHub App installation token) with permission to fire `repository_dispatch` on `rancher/release-automation`. `GITHUB_TOKEN` can't dispatch cross-repo. Without this, the notify step fails but the tag/release are still created — the reconciler will pick the tag up on its next 15-min cron.
- [ ] **Confirm `rancher/release-automation` exists** (this lands in a separate PR). If it doesn't yet, the notify step will fail; same fallback as above.
- [ ] **(Optional, recommended later) Add a tag protection rule** for pattern `v*` allowing only the App/bot identity to push tags. This makes the new workflow the *only* way to produce a release tag. Skipping this for now keeps the migration low-risk; engineers can still `git push origin vX.Y.Z` from a laptop, just shouldn't.
Old way (no longer used): `git tag vX.Y.Z && git push origin vX.Y.Z`.
New way:
1. Go to **Actions → Release → Run workflow**.
2. Pick the branch you want to release from.
3. Enter the version.
4. Hit **Run workflow**.
If validation fails, the workflow exits non-zero with a clear `::error::` message and **no tag is created**. Fix the issue (wrong branch, CI not green, etc.) and re-run.
`ci.yaml`'s `push` trigger lists `master`, which appears stale (the default branch is `main`). Merge commits on `main` therefore have no `CI` workflow run, and the new release workflow's "CI green on this SHA" check will fail when releasing from `main`. Two ways to address:
- **Recommended**: separate one-line PR adding `main` to `ci.yaml`'s `push.branches`. Same fix probably wanted for `integration-tests.yaml`.
- **Workaround**: manually re-run `CI` on `main` via Actions → CI → Run workflow before triggering Release.
This is independent of this PR but worth doing before relying on releases from `main`.
- [ ] On a sandbox branch, run **Release** with a deliberately-wrong version (e.g. `v0.9.5` from `release/v0.7`) — expect failure at "Validate version matches branch's allowed minor". No tag should appear.
- [ ] Run with a non-sequential version (e.g. `v0.9.999`) — expect failure at "Validate version is next-sequential".
- [ ] Run with the correct next-sequential version — expect tag + GH release created, and the dispatch step succeeds (or fails cleanly if the automation repo / secret aren't set up yet).
- [ ] Confirm the new tag triggers no other workflow (the old `push: tags: v*` trigger is gone).
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the existing tag-push-triggered release workflow with a validated
workflow_dispatchflow. The new workflow is the only path that should produce a tag — engineers no longer rungit taglocally.The motivation: today it's easy to tag the wrong version on the wrong branch (e.g.
v0.9.xfromrelease/v0.7), and there's no signal to downstream repos that a release happened. The new workflow validates everything before tagging and notifies the centralrancher/frameworks-automationrepo so the rancher bump PR can open within ~30s.What it does
Trigger from Actions → Release → Run workflow. Pick the branch (e.g.
mainorrelease/v0.7) and enter the version (e.g.v0.9.6). The workflow then:v<major>.<minor>.<patch>[-prerelease].VERSION.mdsays this branch is allowed to release (e.g.release/v0.7→v0.7.x).v0.7.5 → v0.7.7).CI,Integration tests) are green on the head SHA.rancher/frameworks-automationrepo viarepository_dispatchso the reconciler opens the rancher bump PR.permissions: {}is set at the workflow level so each job runs with only the perms it needs (validate: read-only;release:contents:write).Setup checklist (before first use)
AUTOMATION_DISPATCH_TOKEN: a fine-scoped PAT (or GitHub App installation token) with permission to firerepository_dispatchonrancher/frameworks-automation.GITHUB_TOKENcan't dispatch cross-repo. Without this, the notify step fails but the tag/release are still created — the reconciler will pick the tag up on its next 15-min cron.rancher/frameworks-automationexists (this lands in a separate PR). If it doesn't yet, the notify step will fail; same fallback as above.v*allowing only the App/bot identity to push tags. This makes the new workflow the only way to produce a release tag. Skipping this for now keeps the migration low-risk; engineers can stillgit push origin vX.Y.Zfrom a laptop, just shouldn't.How to release after this lands
Old way (no longer used):
git tag vX.Y.Z && git push origin vX.Y.Z.New way:
If validation fails, the workflow exits non-zero with a clear
::error::message and no tag is created. Fix the issue (wrong branch, CI not green, etc.) and re-run.Known issue / follow-up needed
ci.yaml'spushtrigger listsmaster, which appears stale (the default branch ismain). Merge commits onmaintherefore have noCIworkflow run, and the new release workflow's "CI green on this SHA" check will fail when releasing frommain. Two ways to address:maintoci.yaml'spush.branches. Same fix probably wanted forintegration-tests.yaml.CIonmainvia Actions → CI → Run workflow before triggering Release.This is independent of this PR but worth doing before relying on releases from
main.Test plan
v0.9.5fromrelease/v0.7) — expect failure at "Validate version matches branch's allowed minor". No tag should appear.v0.9.999) — expect failure at "Validate version is next-sequential".push: tags: v*trigger is gone).