I wonder the purpose of adding clean up stage in Jenkins CI/CD pipeline to remove release if exist with helm delete
command. What is the main purpose ans use case that we need to clean up the environment that we would like to deploy? Is that still necessary for using upgrade install
command for helm.
helm upgrade --install a-service
When you do helm delete $RELEASE_NAME
it deletes all resources but keeps the record with $RELEASE_NAME in case you want to rollback. You can see removed releases via helm ls -a
. Whereas helm delete --purge $RELEASE_NAME
removes records and make that name free to be reused for another installation.
If your initial release ends up in a failed state then running helm upgrade --install a-service
will throw error
$ helm upgrade "foo" . --install
Error: UPGRADE FAILED: "foo" has no deployed releases
Then you need clean it up using
helm delete foo --purge