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
Target ECR registry by Account ID and Region #20
Conversation
For our use case we store all of our ECR repositories in a single account, and access these repos from others. Therefore we require the need to specify the account which possess the repostories, along with the region. The region wasn't a necessary change however I have seen others requesting this and it was an easy implementation alongside this work.
Reason for this is because when trying to grab the region via the means previously implemented it was unsuccessful on a Buildkite agent running on EC2. As we have changed to using `get-login-password` due to the previous implementation being deprecated, it requires the region as well as the account id to be given as part of the docker login command. Ideally I would leave the region out of these changes entirely. If nothing is given both via the `region` flag or `AWS_DEFAULT_REGION` env var, it will default to `eu-west-1`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, sorry it took me a while to get to it!
local region="${1}" | ||
local account_id="${2}" | ||
|
||
aws ecr get-login-password \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Not a problem, thank you for giving it a once over. |
I'm releasing this as v2.0.0. I had a squiz too and AWS_DEFAULT_REGION looks like the best we can do; I had no luck with |
I think this breaks the |
Patched in #21 |
Background
We're looking to build and push our Docker images to the account where our ECR repositories reside, which are then shared across multiple accounts.
The region we use is the same across all accounts however where we build images is different to where we store them.
Ideally I wouldn't be touching on the region however it's required by get-login-password.
Changes
get-login-password
command, due toget-login
being deprecatedExample
Notes
This may introduce a breaking change in regards to the
region
changes as I couldn't think of a sane way to handle this. Open to ideas on potential nicer ways to handle this.If the
get-login
command wasn't being deprecated we wouldn't have to amend the region, however it seems this has been requested already (#14).