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

Handle Amazon ECR registries associated with other accounts #40

Merged
merged 2 commits into from
Dec 18, 2020
Merged

Handle Amazon ECR registries associated with other accounts #40

merged 2 commits into from
Dec 18, 2020

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Dec 16, 2020

Fixes #39
Fixes docker/build-push-action#253

cc. @michaelb990

@davidski Can be tested with:

name: ci

on:
  push:
    branches: master

jobs:
  login:
    runs-on: ubuntu-latest
    steps:
      -
        name: Login to ECR
        uses: crazy-max/docker-login-action@registry-ids
        with:
          registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com
          username: ${{ secrets.AWS_ACCESS_KEY_ID }}
          password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        env:
          AWS_ACCOUNT_IDS: 012345678910,023456789012

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max marked this pull request as draft December 16, 2020 20:59
@michaelb990
Copy link

michaelb990 commented Dec 16, 2020

It might be easier to write a function in the aws.ts similar to getRegion that just parses the registry URL for the account ID (it will always be the first token in the URL), this way users don't have to pass the registry ID twice.

https://github.com/docker/login-action/blob/master/src/aws.ts#L17

Either way, thanks for the quick turnaround! 🎉

@crazy-max
Copy link
Member Author

@michaelb990 Ok got it! I've made some changes, let me know if it lgty. Thanks again!

@crazy-max crazy-max marked this pull request as ready for review December 17, 2020 05:51
Copy link

@michaelb990 michaelb990 left a comment

Choose a reason for hiding this comment

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

Added 1 comment. Looks good other than that.

src/aws.ts Outdated Show resolved Hide resolved
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Copy link

@michaelb990 michaelb990 left a comment

Choose a reason for hiding this comment

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

LGTM

@crazy-max crazy-max merged commit f336459 into docker:master Dec 18, 2020
@crazy-max crazy-max deleted the registry-ids branch December 18, 2020 06:41
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