fix(validator): accept pre-release tags as release versions#919
Conversation
`aicr validate` failed with ImagePullBackOff on every tagged-release binary because the catalog rewrote :latest to :sha-<commit>, but the release workflow (on-tag.yaml) publishes validator images at :v<version> — including pre-release tags like v0.13.0-rc3. Widen `releaseVersionPattern` to accept a single pre-release suffix segment (vX.Y.Z, vX.Y.Z-rc1, vX.Y.Z-beta, vX.Y.Z-alpha.1), and add an explicit `-next$` exclusion so goreleaser snapshot strings keep falling through to :sha-<commit> (the path on-push.yaml publishes for main-development builds). Git-describe forms like v0.0.0-12-gabc1234 stay excluded by the single-segment shape. Demo: drops the AICR_VALIDATOR_IMAGE_TAG=edge workaround. Fixes #916
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR fixes validator image pull failures when running released aicr binaries by updating catalog image tag resolution to detect release-style version strings and use semantic version tags (e.g., Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report ✅
Coverage BadgeMerging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
Summary
aicr validatefailed withImagePullBackOffon every tagged-release binary because the catalog rewrote:latestto:sha-<commit>, but the release workflow (on-tag.yaml) publishes validator images at:v<version>— including pre-release tags likev0.13.0-rc3. WidensreleaseVersionPatternto accept a single pre-release suffix segment and adds an explicit-next$exclusion so goreleaser snapshot builds keep falling through to:sha-<commit>.Motivation / Context
Reported in #916. The tag-rewrite logic was written when the only published image stream was
on-push.yaml's:sha-<commit>aliases, soreleaseVersionPatternwas deliberately strict (^v?\d+\.\d+\.\d+$). Onceon-tag.yamlstarted publishing:<github.ref_name>for pre-release tags too (v[0-9]+.[0-9]+.[0-9]+*trigger), every install from a released binary likev0.13.0-rc3started chasing a:sha-<commit>image that release CI never pushed.Fixes: #916
Related: N/A
Type of Change
Component(s) Affected
pkg/validator)docs/,examples/)Implementation Notes
New regex:
^v?\d+\.\d+\.\d+(-[A-Za-z0-9.]+)?$. The pre-release suffix is a single alphanumeric-plus-dots segment — multi-segment forms like the git-describe snapshotv0.0.0-12-gabc1234contain an internal dash and are still rejected.New
snapshotSuffixPattern = -next$excludes goreleaser's snapshot template (.goreleaser.yaml:snapshot.version_template: "{{ .Tag }}-next"). This is the critical guard that keeps main-development builds on the:sha-<commit>path (whichon-push.yamlpublishes). The exclusion is documented in code so a future change does not silently re-break dev flow.Build-path coverage with the new logic:
mainpush (on-push.yaml snapshot)v0.X.Y-next:sha-<commit>(falls through via-next$)v0.13.0-rc3v0.13.0-rc3:v0.13.0-rc3v0.13.0(stable)v0.13.0:v0.13.0make buildon main HEADv0.X.Y-next:sha-<commit>v0.X.Y-next:sha-<commit>demos/cuj1-gke-config.md: drops theAICR_VALIDATOR_IMAGE_TAG=edgeworkaround now that the binary asks for the right tag by default.Testing
New test cases in
TestResolveImage:pre-release rc tag rewrites :latest to :vX.Y.Z-rc1(flipped from prior "is not a release")pre-release beta tag rewrites :latest to :vX.Y.Z-betapre-release alpha.1 (dotted) tag rewrites :latestsnapshot of a pre-release tag falls through(v1.0.0-rc1-next)snapshot of stable release with commit → sha tag(v1.0.0-next+ commit)pre-release tag ignores commit (release wins)Existing cases preserved (regressions covered):
-next snapshot version — no tag rewrite— pinned with explanatory comment as the regression guard.git-describe snapshot is not a release— still falls through.Coverage on
pkg/validator/catalog: 97.6%.Risk Assessment
Rollout notes: Backwards-compatible at runtime. The only behavioral change is for binaries whose version string matches the new shape — previously broken with
ImagePullBackOff, now resolves correctly. The-next$exclusion ensures main-development builds keep using:sha-<commit>.Checklist
make testwith-race)make lint)git commit -S)