feat: add ecr remote repository provider - #56
Open
guilhermebr wants to merge 1 commit into
Open
Conversation
Signed-off-by: Guilherme Rezende <guilhermebr@gmail.com>
ravilock
approved these changes
Jul 30, 2026
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.
Fixes #55.
Amazon ECR does not create repositories on first push, so with tsuru's
repository-per-app image naming every new app's deploy fails with an opaque
404 Not Foundat the push step. This adds anecrprovider to the existingremote repository providers framework, alongside the
ociprovider (ECR andOCIR share the no-create-on-push behavior).
Enable it via the existing
REMOTE_REPOSITORY_PATHconfig file:{ "123456789012.dkr.ecr.us-east-1.amazonaws.com": { "provider": "ecr" } }Design/behavior:
same ambient credentials
docker-credential-ecr-loginuses for the push.The identity needs
ecr:CreateRepositoryon the repository prefix (examplepolicy in the README section this PR adds).
"region"config key; falls back to the region embeddedin the ECR hostname (standard and FIPS forms), then to SDK defaults.
RepositoryAlreadyExists= success — repeat deploys are a no-op; othererrors fail the deploy early with the repository name in the message
(consistent with the
ociprovider's failure mode), instead of buildkit'sopaque 404 later.
opinions. Operators who want specific settings can pre-create repositories
with their IaC tooling — the provider treats existing repositories as
success, so both workflows compose.
aws-sdk-go-v2(config + ecr), following the precedent ofoci-go-sdkfor theociprovider.deploys run concurrently (one goroutine per gRPC
Build), and the racedetector confirmed a data race without the guard (test included). Heads-up:
the
ociprovider's lazyauth()has the same latent race; happy to send afollow-up PR mirroring this fix if you agree.
Distribution v2 API, which ECR doesn't support for deletes) is a separate
concern in tsuru's registry package — not addressed here.
Also adds a README section documenting the remote repository providers feature
(config format,
ecr+ociexamples, IAM snippet) — it was previouslyundocumented.
Tests: testify unit tests with a fake ECR client (create, already-exists,
error propagation, image-reference parsing incl. FIPS hosts / nested paths /
tags / digests, provider registration, and the concurrency test above).
Validated in production: running on an EKS cluster with IRSA — new apps'
repositories are auto-created on first deploy; pre-existing repositories
deploy unchanged.