CircleCI-Public / aws-ecr-orb

CircleCI orb for interacting with Amazon's Elastic Container Registry (ECR)
https://circleci.com/orbs/registry/orb/circleci/aws-ecr
MIT License
80 stars 142 forks source link

Documentation inconsistency for circleci/aws-ecr@9.0.2 #320

Closed mdavidovichHst closed 10 months ago

mdavidovichHst commented 10 months ago

Orb version

circleci/aws-ecr@9.0.2

What happened

Documentation at https://circleci.com/developer/orbs/orb/circleci/aws-ecr#commands-build_and_push_image for parameter build_and_push_image.account_id says NO in ther required column but the description says "The 12 digit AWS id associated with the ECR account. This field is required."

Expected behavior

I think it should say YES in the required column, however I'm confused as to why it is. I configure the AWS cli with my access_key_id and secrect_access_key and region. When I use boto3 services in Python for example, I never have to specify an account ID.

Right now I am using long term credentials for an AWS Account that I have access to as an AWS user. For my boto3 examples I have created IAM users that have the permissions needed to do what the user needs to do. Perhaps I need to model this.

brivu commented 10 months ago

Hey @mdavidovichHst,

Thanks for opening this issue. I can see why the orb registry is a bit misleading. The required column will only say YES if there is no default value for the parameter.

In the case for the account_id parameter, if you don't provide one explicitly, it defaults to the expansion of AWS_ACCOUNT_ID (${AWS_ACCOUNT_ID}), which is the an environment variable.

The account ID is a part of your repository's URL: <<AWS_ACCOUNT_ID>>.dkr.ecr.us-west-2.amazonaws.com/<<REPO_NAME>>

Without the account ID, you won't be able to push the image you've built to the repository. If do you not have one stored as in environment variable in CircleCI, my hunch is that it's getting injected in a previous step or it's already stored as an environment variable in the image you're using.

Hope that helps!

mdavidovichHst commented 10 months ago

@brivu Thanks!