Closed kurtisz closed 10 months ago
Hi @kurtisz,
I'm creating a dummy docker image asset here
and use it to get the name of the repository that I need to clean.
I can maybe use the hash of this dummy asset to determine the type of hash that docker images are using. Need to check this.
The CDK
App
class can be given a custom synthesizer, with the option to prefix the image tag for any Docker image in the app, i.e.:Creating a Docker image in this stack results in an image tag like
api-svc5a7abf30ce10141adcb73c9b836ec68479c65fb4d1693df160563e36ece0d55e
.The Extract Template Hashes function specifically looks for an asset with just a hash (no prefix)...
const hashes = template.TemplateBody.match(/[a-f0-9]{64}/g);
...which means a Docker image with an additional prefix does not get extracted and ultimately gets deleted.
Admittedly, I originally used the image prefix feature as a means of tagging images to apply a lifecycle rule to remove old images, and I've moved toward using the Toolkit Cleaner instead (and have since removed the prefix), but in the interim where I had both the prefix and was using the Toolkit Cleaner, the Toolkit Cleaner was removing all of my images, even when they were in use.
A few routes that might work: