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

Push fails when image already exists on repository with tag and is immutable #750

Closed
daveisfera opened this issue May 6, 2024 · 8 comments
Assignees
Labels
bug Something isn't working ecr p2 service-api This issue pertains to the AWS API

Comments

@daveisfera
Copy link

Describe the bug

Pushing an image to a tag where it already exists reports an error

Expected Behavior

If the image is identical, then it should report that it already exists without an error

Current Behavior

An error is reported with return code 254

Reproduction Steps

  1. Put an image with a tag
  2. Put the the same image with the same tag

Possible Solution

Report that it already exists and return success

Additional Information/Context

No response

CLI version used

aws-cli/2.15.17 Python/3.11.7 Darwin/23.4.0 source/x86_64 prompt/off

Environment details (OS name and version, etc.)

macOS 14.4.1

@daveisfera daveisfera added bug Something isn't working needs-triage labels May 6, 2024
@daveisfera
Copy link
Author

Here's an issue from the docker repo:
moby/buildkit#3776

@tim-finnigan
Copy link

Thanks for reaching out. Are you using any ECR CLI commands or can you provide more details on your workflow? It seems like this issue relates more to Docker/ECR than the CLI directly. We can forward issues to service teams like ECR if necessary. I saw one other issue (aws/containers-roadmap#862) in an AWS repository referencing that error but it looks like that was closed a few years ago.

@tim-finnigan tim-finnigan added response-requested This issue requires a response to continue service-api This issue pertains to the AWS API ecr p2 and removed investigating needs-triage labels May 15, 2024
@daveisfera
Copy link
Author

We do a build with the SHA of the git commit and tag that for each PR and then when it's merged to branch associated with an environment we get the manifest using this command:

aws ecr batch-get-image --repository-name mycompany/myrepo --image-ids imageTag="${git_sha} --query 'images[].imageManifest' --output text

And then we tag it to that branch using this command:

 aws ecr put-image --repository-name mycompany/myrepo --image-tag "${branch}" --image-manifest "$MANIFEST"

That works just fine, but if the deploy fails and we need to re-run that, then the put-image command fails since the exact image is already there. It would be nice if this could be handled somehow and the linked to issue from buildkit indicates that it's a "client problem"

@github-actions github-actions bot removed the response-requested This issue requires a response to continue label May 16, 2024
@amberkushwaha
Copy link

aws ecr batch-get-image --repository-name mycompany/myrepo --image-ids imageTag="${git_sha} --query 'images[].imageManifest' --output text
This code has been updated in the main stream scenario.

@daveisfera
Copy link
Author

So this will be fixed in an upcoming version? If so, which version number and is there an expected release date?

@tim-finnigan
Copy link

tim-finnigan commented May 20, 2024

Thanks for following up. I'm going to reach out to the ECR team regarding this issue (ref: P130774841), as they own the underlying BatchGetImage / PutImage APIs. I'm also going to transfer this to our cross-SDK repository since service APIs like these are used across AWS SDKs in addition to the AWS CLI. I'll share any updates here in the issue.

@tim-finnigan tim-finnigan transferred this issue from aws/aws-cli May 20, 2024
@tim-finnigan
Copy link

We heard back from the ECR team and they recommended creating an issue in this repository where they publicly tracks customer feature requests: https://github.com/aws/containers-roadmap

You can can see if a similar feature request already exists, or create one if not. Those issues are reviewed by the ECR service team.

As far as workarounds on the client-side, you can either treating ImageAlreadyExistsException as a non-exception or check if an image exists before calling put-image.

@tim-finnigan tim-finnigan closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Copy link

This issue is now closed.

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ecr p2 service-api This issue pertains to the AWS API
Projects
None yet
Development

No branches or pull requests

3 participants