Skip to content

refactor(ecrref): dedupe the private-ECR-image parser into a leaf package - #491

Merged
scttfrdmn merged 1 commit into
mainfrom
refactor/ecrref-dedup
Aug 7, 2026
Merged

refactor(ecrref): dedupe the private-ECR-image parser into a leaf package#491
scttfrdmn merged 1 commit into
mainfrom
refactor/ecrref-dedup

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

  • cmd/app_byo.go and pkg/taskproto/wrapper.go each carried an independent copy of ecrImageAccount/ecrRegistryHost (the taskproto copy explicitly duplicated rather than imported, per its own comment, since taskproto must not depend on cmd). pkg/userdata/container.go (Headless container-run library primitive (DCV-free docker run of an image ref) #353, PR feat(userdata): headless container-run library primitive #490) added a third, slightly different variant (ecrImageAccountHost, which also resolves the auth region) — flagged as a loose end in that PR's summary.
  • New pkg/ecrref (stdlib-only leaf): Account, RegistryHost, and AuthHost (the combined host+region lookup userdata needs — the image's own embedded region wins over a caller-supplied fallback, since a cross-region ECR pull must authenticate against its own region).
  • cmd/taskproto's existing functions become one-line aliases over the shared leaf — no call-site or test-name changes anywhere, purely internal dedup.

Test plan

  • go build ./..., go vet ./..., gofmt -l clean
  • New pkg/ecrref tests (TestAccount, TestRegistryHost, TestAuthHost) + existing cmd/taskproto/userdata ECR-related tests all pass through the aliases unchanged
  • golangci-lint run on all 4 touched files — 0 new issues (confirmed the 20 pre-existing repo-wide issues are all in untouched files)
  • make check-docs — no drift
  • TestCatalogValid still fails locally — pre-existing, unrelated (spawn#489, fix in libs#38, not yet released/bumped)

…kage

cmd/app_byo.go and pkg/taskproto/wrapper.go each carried an independent
copy of ecrImageAccount/ecrRegistryHost (the taskproto copy explicitly
duplicated rather than imported, since taskproto must not depend on
cmd). pkg/userdata/container.go (#353/PR #490) was about to become a
third divergence point with its own slightly-different variant
(ecrImageAccountHost, which also resolves the auth region).

New pkg/ecrref (stdlib-only leaf): Account, RegistryHost, and AuthHost
(the combined host+region lookup userdata needs, with the image's own
region winning over a caller-supplied fallback). Both cmd and
taskproto's existing functions become one-line aliases over it -- no
call-site or test-name changes, so this is purely internal dedup.
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 00eaf6f into main Aug 7, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the refactor/ecrref-dedup branch August 7, 2026 18:52
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.

1 participant