feat(ecr): add option to auto delete images upon ECR repo removal#15932
feat(ecr): add option to auto delete images upon ECR repo removal#15932kirintwn wants to merge 1 commit intoaws:masterfrom
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Hello @madeline-k, hope you're well. Any chance we can have this PR reviewed please ? We are in dire need for this feature (ability to delete non-empty ECR). @kirintwn has thankfully developed it but it is waiting to be merged. |
|
Hello @peterwoodworth, hope you're well. Any chance we can have this PR reviewed please ? We are in dire need for this feature (ability to delete non-empty ECR). @kirintwn has thankfully developed it but it is waiting to be merged. |
|
Hello @madeline-k would greatly appreciate if we can have this PR reviewed and possibly merged please ? |
|
@kirintwn I have a question about your implementation. Suppose someone deploys their stack with an ECR repo with |
| * @param ECR.ListImagesRequest the repositoryName & nextToken if presented | ||
| */ | ||
| async function emptyRepository(params: ECR.ListImagesRequest) { | ||
| const listedImages = await ecr.listImages(params).promise(); |
There was a problem hiding this comment.
@kirintwn If the ECR repo was already deleted out-of-band, this will cause the custom resource deletion to fail with an error.
924c117 to
ebfd5f2
Compare
|
This PR has been deemed to be abandoned, and will be closed. Please create a new PR for these changes if you think this decision has been made in error. |
…al (#24572) This request fixes the ECR Repository resource to allow setting a flag on the resource to auto delete the images in the repository. This is similar to the way S3 handles the autoDeleteObjects attribute. This code base starts from a stalled PR [#15932](#15932). This also takes into account the functionality added into S3 to create tag to not delete images if the flag is flipped from true to false. Closes [#12618](#12618) References closed and not merged PR [#15932](#15932) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…al (aws#24572) This request fixes the ECR Repository resource to allow setting a flag on the resource to auto delete the images in the repository. This is similar to the way S3 handles the autoDeleteObjects attribute. This code base starts from a stalled PR [aws#15932](aws#15932). This also takes into account the functionality added into S3 to create tag to not delete images if the flag is flipped from true to false. Closes [aws#12618](aws#12618) References closed and not merged PR [aws#15932](aws#15932) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Closes #2765 #12618.
Use Case
ECR repositories currently do not get delete if they contain images even the
removalPolicyis set toDESTROY.It was reported in #2765, and was thought to be a responsibility of CloudFormation team aws-cloudformation/cloudformation-coverage-roadmap#515.
Proposed Solution
I do think we should add a option to force delete the images using custom resource provider, which is just like #12090 that uses a custom resource provider to delete objects in s3.
The code might looks like this:
The props
autoDeleteImagescan only to be true ifremovalPolicyis set toDESTROY.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license