ci: block tag builds when tag != VERSION-DOCKERREVISION - #17
Conversation
Images and the Helm chart are versioned from VERSION-DOCKERREVISION in docker-publish.yml, not from the git tag name. Add a check-tag gate that fails a tag run when vX.Y.Z-N disagrees with that env, so a release tag can never diverge from what is actually built and published. The job runs on all events but only enforces on tags; test depends on it and everything depends on test, so a mismatch blocks the whole pipeline.
📝 WalkthroughWalkthroughAdds a ChangesCI Tag Validation Workflow
Estimated code review effort: 1 (Trivial) | ~5 minutes Related PRs: None found. Suggested labels: ci, github-actions Suggested reviewers: guimard 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/docker-publish.yml (1)
23-37: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winAdd explicit least-privilege
permissionstocheck-tag.Static analysis flags this job for using default (potentially broad)
GITHUB_TOKENpermissions since nopermissions:block is set. This job only runs a shell comparison and doesn't need any token scopes.🔒 Proposed fix
check-tag: runs-on: ubuntu-latest + permissions: {} steps: - name: Tag must equal v${VERSION}-${DOCKERREVISION}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/docker-publish.yml around lines 23 - 37, The check-tag job currently relies on the default GITHUB_TOKEN scope even though it only performs a shell-based tag comparison. Add an explicit permissions block to the check-tag job in docker-publish.yml that sets the job to least privilege (no token scopes needed), keeping the existing tag validation logic in the Tag must equal v${VERSION}-${DOCKERREVISION} step unchanged.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/docker-publish.yml:
- Around line 23-37: The check-tag job currently relies on the default
GITHUB_TOKEN scope even though it only performs a shell-based tag comparison.
Add an explicit permissions block to the check-tag job in docker-publish.yml
that sets the job to least privilege (no token scopes needed), keeping the
existing tag validation logic in the Tag must equal
v${VERSION}-${DOCKERREVISION} step unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a8ed1164-afa6-4b4a-ab71-c6259bb06086
📒 Files selected for processing (1)
.github/workflows/docker-publish.yml
What
Adds a
check-taggate job to.github/workflows/docker-publish.yml.On a version tag (
v*), it fails the run unless the tag matchesVERSION-DOCKERREVISIONfrom the workflow env — e.g. withVERSION: 2.23.0and
DOCKERREVISION: 2, onlyv2.23.0-2is allowed.Why
Both the Docker image tags (via
docker-common) and the Helm chart (via thepublish-helmjob) are versioned fromVERSION-DOCKERREVISION, not from thegit tag name. A tag whose name disagrees with that env would build/publish
under a different version than the tag implies (or, before the env-based Helm
fix, reference images that don't exist). This gate makes such a mismatch fail
fast instead of producing a misleading release.
How
check-tagalways runs, but the check step is guarded byif: startsWith(github.ref, 'refs/tags/')→ it's a no-op success on branchpushes.
testnowneeds: check-tag, and every other job transitively depends ontest, so a mismatch blocks the entire pipeline (build + publish-helm).Behaviour
v2.23.0-2v2.23.0-3To release: bump
VERSION/DOCKERREVISIONand tagv<VERSION>-<DOCKERREVISION>.Summary by CodeRabbit
vX.Y.Z-REVISIONpattern.