Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ecr] Lookup function for ECR repositories #8461

Open
2 tasks
leandropadua opened this issue Jun 10, 2020 · 4 comments
Open
2 tasks

[ecr] Lookup function for ECR repositories #8461

leandropadua opened this issue Jun 10, 2020 · 4 comments
Assignees
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@leandropadua
Copy link

Implement fromLookup for aws-ecr in order to query the repository during synth time.

Use Case

Currently when using ECR, if we try to import a repository that doesn't exist using fromRepositoryArn, fromRepositoryAttributes or fromRepositoryName, it doesn't check if the repository actually exist and sometimes we will only find that out through runtime errors when trying to push to that repo.

Using a lookup, we could treat the error during synth and therefore, create a repo if it doesn't exist.

Proposed Solution

suggested method signature:

public static fromLookup(scope: Construct, id: string, options: EcrLookupOptions): IRepository

example of usage:

const myRepo = ecr.Repository.fromLookup(stack, 'MyRepository', {
  repositoryName: ...,
  repositoryArn: ...,
});

Other

Related stackoverflow issue using the CLI https://stackoverflow.com/questions/51028677/create-aws-ecr-repository-if-it-doesnt-exist

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@leandropadua leandropadua added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 10, 2020
@SomayaB SomayaB added the @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry label Jun 11, 2020
@MrArnoldPalmer MrArnoldPalmer added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 17, 2020
@SoManyHs SoManyHs changed the title Lookup function for ECR repositories [ecr] Lookup function for ECR repositories Jan 4, 2021
@MrArnoldPalmer MrArnoldPalmer added the effort/medium Medium work item – several days of effort label May 17, 2021
@MrArnoldPalmer MrArnoldPalmer removed their assignment Jun 21, 2021
@nohack
Copy link
Contributor

nohack commented Jul 21, 2021

@MrArnoldPalmer created this pr.please let me know if it looks ok.

@kierans
Copy link

kierans commented Sep 28, 2021

Another use case for this is repo replication. If I have an ECR repository in one region, and I want to replicate the images to another region I need to find lookup the source repo in the "main" region.

@mrpackethead
Copy link

The scope of this needs to be wider. There needs to be a standardised way of creating contexts for user-created lookups.. The users want to do ECR lookups, but for me, its other things.. You could solve the specific use-case here, but the other approach would be to provide a method to do arbitory lookups ( using sdk calls, which is what the 'built in lookups' do anyway, and cache them.

@Kazpers
Copy link

Kazpers commented Nov 30, 2022

@mrpackethead I agree that would be nice, but I'd settle for solving it on a case-by-case basis over it not being solved at all... This would be a really nice feature but it's still not here after 2½ years.

@nohack Sadly it seems the PR died "on the vine" although it looked like it did exactly what was desired. How can we revive it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants