fix(docker-ecr): keep prerelease suffix in the published image tag - #91
Merged
Merged
Conversation
The version was extracted with an unanchored `grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+'`. Because `v1.2.3-beta` contains `v1.2.3` as a substring, the match dropped the suffix and the image was pushed as `:v1.2.3` — a prerelease squatting the release tag, with the digest registered against the wrong version. Replace the extraction with an anchored match that separates an optional monorepo prefix from the full SemVer, so prerelease and build metadata survive. Tags that aren't semver-shaped (`beta`, `latest`) still pass through untouched, and `logs-controller-v2.0.0 -> v2.0.0` keeps working. Also expose the resolved tag as a new `image_tag` output. Callers that need to reference the pushed image (e.g. an overlay image doing `FROM <base>:<tag>`) were passing `github.ref_name` and assuming the reusable does not transform it, which is exactly the assumption that broke here. Verified against the real tag inputs of every caller of this workflow: no change in behaviour for any of them other than the prerelease case.
sebasnallar
approved these changes
Aug 20, 2026
2 tasks
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.
What
The published tag was derived with an unanchored extraction:
VERSION=$(echo "${TAG}" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "${TAG}")The intent is prefix stripping (
logs-controller-v2.0.0->v2.0.0), but as anunanchored
grep -oEit also matches the substringv1.2.3insidev1.2.3-betaanddrops the prerelease suffix, so the image is pushed as
:v1.2.3.Two consequences:
v1.2.3-betalands on:v1.2.3,and whichever of the two builds runs last wins. Any digest recorded downstream then
points at prerelease content under a release version.
FROM <base>:${BASE_VERSION}, withBASE_VERSIONtaken fromgithub.ref_name, getsmanifest unknown— the base landed under a tag the caller never sees.The
|| echo "${TAG}"fallback is why this stayed latent: tags with novX.Y.Zsubstring (
beta,latest,1.2.3) never matched and passed through untouched. Only av-prefixed prerelease triggers it.Change
Anchored match separating an optional prefix from the full SemVer, so prerelease and
build metadata survive:
Plus a new
image_tagoutput exposing the resolved tag, so a caller that needs toreference the pushed image can read it instead of re-deriving it from
github.ref_name.That re-derivation is exactly the assumption that breaks in consequence 2 above — a
reusable workflow that normalises an input should hand the result back rather than leave
callers coupled to an internal detail.
Verified
Ran the old and the new logic side by side over the tag shapes this workflow receives
today:
v1.2.3-betav1.2.3-betav1.2.3v1.2.3-beta.1v1.2.3-beta.1v1.2.3v1.2.3+build.5v1.2.3+build.5v1.2.3v1.2.3v1.2.31.2.31.2.3betabetalatestlatestlogs-controller-v2.0.0v2.0.0some-image-1.8.01.8.0No behaviour change for any tag shape in use other than the prerelease cases. The last
row is a bonus fix: an unprefixed monorepo-style tag used to pass through whole, because
it has no
vfor the old pattern to match.actionlintreports no findings on the file.Not included
No regression test — there is no harness in this repo for the shell embedded in
run:blocks. The comparison above was run by hand.