I would suggest to double check your rules because, for example, you're using tagPrefixList
and this has a one small gotcha...
an image is successfully matched if ALL of the tags in the tagPrefixList
value are matched against any of the image's tags
In other words, when working with tagPrefixList
be aware of the following:
(...) if your images are tagged as prod
, prod1
, prod2
, and so on, you
would use the tag prefix prod
to specify all of them. If you specify
multiple tags, only the images with all specified tags are selected
Having said that, the tagPrefixList
property in the policy only considers the prefix portion of the tag and does not account for any characters beyond the prefix. In your case, the policy should match tags like frontend-pr-65
because the prefix frontend-pr-
is present, but it will not match tags with additional characters or numeric suffixes like frontend-pr-65-1
.
So, you either need to expand the tag by adding, say, frontend-pr-65-
or, ideally, use regex, but this is not supported yet. :(
Here's the corresponding issue: https://github.com/aws/containers-roadmap/issues/1213
Also, keep in mind that
If an image is referenced by a manifest list, it cannot be expired without the manifest list being deleted first
So, check that as well.
Finally, make sure that your fronted-pr
images are not marked anywhere else, say in other rules with higher priority, because
Rules can never mark images that are marked by higher priority rules, but can still identify them as if they haven't been expired
If in doubt, please consult the logic of the lifecycle policy evaluator in more detail here.