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

Add support for creating ECR repos #24

Merged
merged 2 commits into from Aug 28, 2021
Merged

Add support for creating ECR repos #24

merged 2 commits into from Aug 28, 2021

Conversation

colinhoglund
Copy link
Contributor

This adds support for creating the ECR repo, similar to https://github.com/drone-plugins/drone-docker and https://github.com/drone-plugins/drone-buildah.

@colinhoglund
Copy link
Contributor Author

Hey @shubham149, just looking for feedback on this PR when you get a chance. Let me know if you need more information/context.

var createErr error
switch registry {
case ecrPublicDomain:
splitRepo := strings.SplitN(repo, "/", 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is assumed that user provided repo does not have registry present in it. We can possibly use this in L156 as well as L180.

if !strings.HasPrefix(repo, registry) { repo = fmt.Sprintf("%s/%s", registry, repo) }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shubham149, thanks for taking a look at this. This was actually splitting on the registry alias, not the public domain itself. See aws docs here. For example, all ECR public registries look like public.ecr.aws/<registry-alias>/<repositiry-name>:<tag>.

However, I've updated the logic to instead include the registry alias in the registry field, instead of the repo field, which I think is a little less confusing.

So now you can just define:

...
registry: public.ecr.aws/registry-alias
repo: repo-name
create_repository: true
...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants