Skip to content

put-image fails when image already exists on repository with tag and is immutable #9328

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

Open
1 task
daveisfera opened this issue Feb 27, 2025 · 6 comments
Open
1 task
Assignees
Labels
bug This issue is a bug. duplicate This issue is a duplicate. ecr investigating This issue is being investigated and/or work is in progress to resolve the issue.

Comments

@daveisfera
Copy link

Describe the bug

Following up on this because currently put-image will error out when a build doesn't change the built image and the tag already exists with that image:
aws/aws-sdk#750

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Have an option to ignore this or an exit code to indicate this issue, because it appears that currently the status code for all errors is 254 so there's no way to tell the difference between a "safe"/expected error and an actual problem

Current Behavior

Errors out with the same status code as all other errors

Reproduction Steps

  1. Push an image to a tag
  2. Try pushing the same image to the same tag
  3. Observe that it fails

Possible Solution

Flag to ignore this error or have different status codes to indicate how it failed

Additional Information/Context

No response

CLI version used

aws-cli/2.24.7

Environment details (OS name and version, etc.)

Python/3.12.9 Darwin/24.3.0 source/x86_64

@daveisfera daveisfera added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 27, 2025
@khushail
Copy link

khushail commented Feb 27, 2025

Hi @daveisfera , thanks for reaching out.

I see you have already files a case for this request with AWS Team -aws/containers-roadmap#2380 as suggested by our teammember earlier.. So IMO if you need any updates, you would have to follow up there.

EDIT: A workaround is also suggested here.

@khushail khushail added ecr and removed needs-triage This issue or PR still needs to be triaged. labels Feb 27, 2025
@khushail khushail self-assigned this Feb 27, 2025
@khushail
Copy link

closing this as duplicate as its just a follow up. Request you to post comments on the original issue filed with AWS team. Thanks

@khushail khushail removed their assignment Feb 27, 2025
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@khushail khushail added the duplicate This issue is a duplicate. label Feb 27, 2025
@daveisfera
Copy link
Author

That issue is asking that ECR allow those requests when the content is identical and there has been no response.
This issue is requesting that the aws-cli handle this or at least expose a way to handle this so that different types of errors can be handled. Also, the suggested workaround isn't possible, so it's not actually a workaround. I would comment that in that issue but it's been archived so there's not a way to follow up there.
This isn't a duplicate of the other and unless the other is going to be resolved, then this is necessary.

@khushail khushail reopened this Feb 27, 2025
@khushail khushail added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Feb 27, 2025
@khushail
Copy link

Hi @daveisfera , I tried to repro the issue with put-image command. Sharing what I observed -

  1. I am not able to put-images at all with this put-image commnd. Checked the IAM policies, got authenticated with docker , still no success.
  2. Tried a workaround to put-images.
  • Authenticated with ECR(making sure it has the same region and accountid) -
    aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
  • checking my reprository in same region
    aws ecr describe-repositories --repository-name my-repo
  • alternate to put-image which succeeds first time-
    `docker tag cdk-e9194c9afdbe793e29b1b99a3697fb145cd194a7438f2e4230872465143beef2:latest <aws_account_id>.dkr.ecr..amazonaws.com/my-repo:latest

docker push <aws_account_id>.dkr.ecr..amazonaws.com/my-repo:latest
`

  • Redeploying the same image with same tag shows it already exists -
Image

Let me know if its helpful.

I see this issue is open but there has been no action so I would consult with the team on the next steps. will share updates soon.

@khushail khushail added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 27, 2025
@daveisfera
Copy link
Author

Here's the commands I run that run into the error with ${tag} being defined as the ${branch} that's being deployed and the SHA of the commit that was for that build:

MANIFEST=$(aws ecr batch-get-image --repository-name myorg/myproj --image-ids imageTag="${tag}" --query 'images[].imageManifest' --output text)
aws ecr put-image --repository-name myorg/myproj --image-tag "${branch}" --image-manifest "$MANIFEST"

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. duplicate This issue is a duplicate. ecr investigating This issue is being investigated and/or work is in progress to resolve the issue.
Projects
None yet
Development

No branches or pull requests

3 participants