Closed daveisfera closed 1 month ago
Here's an issue from the docker repo: https://github.com/moby/buildkit/issues/3776
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 (https://github.com/aws/containers-roadmap/issues/862) in an AWS repository referencing that error but it looks like that was closed a few years ago.
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"
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.
So this will be fixed in an upcoming version? If so, which version number and is there an expected release date?
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.
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
.
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.
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
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