-
Notifications
You must be signed in to change notification settings - Fork 142
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 login succeeds, but push fails with HEAD request 401 unauthorized #345
Comments
@aoyama-val can you check that the role stored in |
The role has these permissions at least: {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "ecr:BatchCheckLayerAvailability",
"Resource": [
"arn:aws:ecr:*****"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ecr:CompleteLayerUpload",
"ecr:UploadLayerPart",
"ecr:InitiateLayerUpload",
"ecr:PutImage",
"ecr:BatchGetImage"
],
"Resource": [
"arn:aws:ecr:*****"
]
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": "ecr:GetAuthorizationToken",
"Resource": "*"
}
]
} The config was working fine with aws-ecr@8.2.1 + aws-cli@3.1.4, however I faced the issue when tried to upgrade the orbs. Thanks. |
I added Allow All permission to the role, but still push failed with the same error. {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
} Also I changed the auth method from OIDC to access key/secret, and it worked fine. So I guess something about OIDC is wrong. |
@aoyama-val what is the definition for the role that you are using for OIDC? Pay special attention at the |
Carefully checked it but everything seemed correct. Also tried deleting the whole {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::XXXXXXXXXXXX:oidc-provider/oidc.circleci.com/org/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"Action": "sts:AssumeRoleWithWebIdentity"
}
]
} |
I'm facing the same problem. I've been using version 9.0.1 and it was working, but as soon as I upgraded to 9.1.0 it's no longer working. It happens on the attempt to push the image.
|
Same issue, starting v9.0.3 |
Confirm downgrading to v9.0.1 fix the issue |
This is more likely a problem with the aws-cli orb, could you do a aws-cli/setup command alone and validate the authentication worked? You can do something like this:
A combination of versions that should work using OIDC is: circleci/aws-cli@5.1.0 and circleci/aws-ecr-orb@9.3.0. |
|
@sylwit That's right, the auth shouldn't be required. Is that causing something related to his issue? |
Hello, we face the same issue trying to migrate from
Did you guys find a fix? |
@b-jan how are you doing the authentication to ECR? Are you enabling credentials helper? |
Thanks @marboledacci, We fixed our issue by adding these parameters :
We added |
@aoyama-val were you able to resolve this issue? I'm facing the same situation after updating. |
If you just want things to work the way they did before, wherever you use - aws-ecr/build_and_push_image:
auth:
- aws-cli/setup:
role_arn: arn:aws:iam::<account_id>:role/role_name
- run:
name: "Export AWS credentials"
command: |
echo "export AWS_ACCESS_KEY_ID=$AWS_CLI_STR_ACCESS_KEY_ID" >> $BASH_ENV
echo "export AWS_SECRET_ACCESS_KEY=$AWS_CLI_STR_SECRET_ACCESS_KEY" >> $BASH_ENV
echo "export AWS_SESSION_TOKEN=$AWS_CLI_STR_SESSION_TOKEN" >> $BASH_ENV
- run:
name: "Validation"
command: aws sts get-caller-identity
... ExplanationThis is due to changes in the I also added a validation step to make sure this is actually succeeding and not pushing the issue down the road after doing a whole Docker image build. |
Orb version
9.1.0
What happened
Expected behavior
Push succeeds.
The text was updated successfully, but these errors were encountered: