fix(deploy): don't split digest-pinned image refs (#72)

splitImageReference checked for '@' AFTER the last colon — but digests
put '@' before it, so `nginx@sha256:abc` split into
name=nginx@sha256/tag=abc. The deploy sync loop wrote those mangled
pairs into the deployments table for any digest-pinned image.

Any ref containing '@' now returns whole with the fallback tag. Table
tests cover registry ports, digests, and tag+digest combos.

Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomáš DvořákandDevin authored and GitHub committed 2026-10-10 02:17:36 +02:00
1 parent 26f495ac8e
commit 985d22798c
2 files changed
+53 -1

No files matched your search

+7 -1
View File
@@ -803,9 +803,15 @@ func splitImageReference(image, fallbackTag string) (string, string) {
return "", fallbackTag
}
// Digest-pinned refs (name[:tag]@sha256:…) carry no usable tag — the
// colon lives inside the digest and must not be split.
if strings.Contains(image, "@") {
return image, fallbackTag
}
lastSlash := strings.LastIndex(image, "/")
lastColon := strings.LastIndex(image, ":")
if lastColon > lastSlash && !strings.Contains(image[lastColon:], "@") {
if lastColon > lastSlash {
return image[:lastColon], image[lastColon+1:]
}