In our ECR, we are having multiple repositories for each microservice.
Service 1
Service 2
Service 3
while building the code (for anyone service), creating an image out of it and pushing to ECR, we tag it with keyword - dev and build-XXX-XXX-XXX-XXX.
If we do this process again, the new image will be tagged as above, but the above image (which is now previous) will be only tagged as build-XXX-XXX-XXX-XXX.
How do I set lifecycle policy to remove only those image which is tagged only as build-XXX-XXX-XXX-XXX
I set below policy, but during a test run, I can see that it is also picking up those images which are tagged as dev which I don't want to delete.
dev tagged image will always be present with build-XXX-XXX-XXX-XXX
{
"rules": [
{
"action": {
"type": "expire"
},
"selection": {
"countType": "imageCountMoreThan",
"countNumber": 5,
"tagStatus": "tagged",
"tagPrefixList": [
"build"
]
},
"description": "remove images starting with build",
"rulePriority": 1
}
]
}
In the same repo, I also push test and UAT images with respective tags (test & uat), with the exactly above process (with build-XXX-XXX-XXX-XXX as well) and don't want to delete them too.
devtag can't exist on two images at the same time. I am not sure what you're asking here. - jordanm