From e3a0bd77007550333411c0c361059edbfb20537a Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 16 Sep 2026 10:36:48 -0400 Subject: [PATCH] feat(chelm): resolve ${image_name} and ${registry_repo_prefix} in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous sdk bump made `chelm generate` accept the two new markers at build time, but testResolver silently returned "" for them — downstream chart tests using the split hub/image/tag shape rendered empty image fields. Example that now resolves under TestParams{Registry:"cgr.test", Repository:"chainguard/test"}: global: hub: ${registry_repo_prefix} # cgr.test/chainguard/test proxy: image: ${image_name} # Co-Authored-By: Claude Opus 4.7 --- chelm/internal/chelm/values.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chelm/internal/chelm/values.go b/chelm/internal/chelm/values.go index 3d66103..8ee92c4 100644 --- a/chelm/internal/chelm/values.go +++ b/chelm/internal/chelm/values.go @@ -143,6 +143,14 @@ func resolveField(f images.RefField, imageID string, repo name.Repository) strin return DefaultTestTag + "@" + d.String() case images.Ref: return repo.Digest(d.String()).Name() + case images.ImageName: + return strings.ToLower(imageID) + case images.RegistryRepoPrefix: + full := repo.Name() + if idx := strings.LastIndex(full, "/"); idx >= 0 { + return full[:idx] + } + return full default: return "" }