openrewrite / rewrite-kubernetes

OpenRewrite recipes for Kubernetes.
Apache License 2.0
9 stars 8 forks source link

org.openrewrite.kubernetes.UpdateContainerImageName do not have option to update image digest #45

Closed davidtam closed 9 months ago

davidtam commented 10 months ago

What problem are you trying to solve?

When I use org.openrewrite.kubernetes.UpdateContainerImageNamesome of the image contains image digest. I want to be able to update the tag and remove the digest (or perhaps have to option to specify a new digest)

Describe the solution you'd like

add option String / digestToUpdate and some way to remove digest

Have you considered any alternatives or workarounds?

Cannot think of one atm

Additional context

Are you interested in contributing this feature to OpenRewrite?

yes but I need to find out the situation in my company

timtebeek commented 10 months ago

Hi @davidtam ; thanks for the suggestion and offer to help! Indeed it doesn't make sense to retain an old digest when updating to a new container image name. Perhaps the best way to start is to add a new unit test to UpdateContainerImageNameTest.java to show exactly what you're looking to change in a draft PR? Then from there we can see what the required changes would be to the recipe. Initially I'd start with removing any digest, as I think it's most common for folks to want to update to a new tag.

DavidTamLloyds commented 9 months ago

@timtebeek thank you - I have an approval to contribute now and I will start from what you have said

timtebeek commented 9 months ago

Fixed in

Thanks again!