Closed OG84 closed 4 months ago
Hi, I had to run the state machine multiple times, to clean all the ECR images. Even though the output stated it e.g. deleted 300+ images, only a fraction of the images got deleted.
I guess it's either due to the 100 id length limit on the ECR batch delete command (https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_BatchDeleteImage.html#API_BatchDeleteImage_RequestSyntax)
or
maybe it makes sense to not silently increase the deleted counter (https://github.com/jogold/cloudstructs/blob/master/src/toolkit-cleaner/clean-images.lambda.ts#L47), but instead inspect the response of the batch delete command, seems like it can also contain information about both successful and failed image ids (https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecr/Interface/BatchDeleteImageCommandOutput/)
anyway, very useful so far, I will just run it multiple times.
Hi @OG84
This is strange because I use DescribeImages which returns up to 100 images. The results are filtered and then passed to BatchDeleteImage.
DescribeImages
BatchDeleteImage
yeah you're right, then it must be something else on my side.
Hi, I had to run the state machine multiple times, to clean all the ECR images. Even though the output stated it e.g. deleted 300+ images, only a fraction of the images got deleted.
I guess it's either due to the 100 id length limit on the ECR batch delete command (https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_BatchDeleteImage.html#API_BatchDeleteImage_RequestSyntax)
or
maybe it makes sense to not silently increase the deleted counter (https://github.com/jogold/cloudstructs/blob/master/src/toolkit-cleaner/clean-images.lambda.ts#L47), but instead inspect the response of the batch delete command, seems like it can also contain information about both successful and failed image ids (https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecr/Interface/BatchDeleteImageCommandOutput/)
anyway, very useful so far, I will just run it multiple times.