Skip to content

feat: format-based image registry rewrite (replaces scion-* heuristic)#8

Open
zeroasterisk wants to merge 1 commit into
mainfrom
feat/format-based-image-rewrite
Open

feat: format-based image registry rewrite (replaces scion-* heuristic)#8
zeroasterisk wants to merge 1 commit into
mainfrom
feat/format-based-image-rewrite

Conversation

@zeroasterisk

Copy link
Copy Markdown
Owner

Summary

Implements Alternative A from ptone#265: format-based image registry rewrite detection.

  • Fully qualified images (first path component contains . or :) are kept as-is — e.g. ghcr.io/myorg/scion-elixir:latest, us-docker.pkg.dev/proj/repo/scion-claude:latest, localhost:5000/myimage:dev
  • Bare names are rewritten to the configured image_registry — e.g. scion-claude:latest, my-custom-agent:v2
  • Relative paths (no domain) are also rewritten — e.g. library/scion-claude:latest

This replaces the scion-* prefix heuristic which broke when template authors used fully-qualified scion-* images from external registries. It also deprecates the image_pinned workaround from PR GoogleCloudPlatform#425 — that flag is no longer needed since the format-based detection handles the use case natively.

Changes

  • pkg/config/settings_v1.go: Rewrote RewriteImageRegistry() — now uses Docker/OCI convention (. or : in first path component = registry domain) instead of scion-* basename prefix check
  • pkg/config/settings_v1_test.go: Replaced test suite with 20 test cases covering bare scion names, bare non-scion names, relative paths, fully-qualified images (ghcr.io, us-docker.pkg.dev, docker.io, localhost:5000, custom.registry:5000), sha256 digests, and edge cases

Test plan

  • go test ./pkg/config/... -run TestRewriteImageRegistry — all 20 cases pass
  • go vet ./... — clean
  • go build ./... — clean
  • Verify with a real template using a fully-qualified external scion-* image

Resolves ptone#265

…ction

Use Docker/OCI convention to detect fully-qualified image references:
if the first path component contains a '.' or ':' it's a registry domain,
so keep the image as-is. Bare names and relative paths are rewritten to
the configured image_registry.

This is more correct than the scion-* prefix heuristic because:
- Fully-qualified scion-* images from external registries are preserved
- Non-scion bare names are now also rewritten (previously skipped)
- No need for an image_pinned workaround flag

Resolves ptone#265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image registry rewrite uses unreliable scion-* heuristic; consider format-based detection

1 participant