Jenkins X - Delete Charmuseum apps manually

Image result for chartmuseum helm

Jenkins X is comprised of many open source components.  One of those is Chartmuseum which is used to store your published apps packaged as Helm charts.  There are times when you need to ensure all of the previous versions of a given app is deleted.  On this post I show you a couple of ways to get the job done!

 

Using Jenkins X CLI

Using the CLI, we can execute a couple of commands to achive this.  The first one is as follows:

jx rsh

You then select the Chartmuseum Pod.  Once in the pod.  Next once in the shell, cd /storage and remove the app in question.

 

Using Postman Client

Deleting apps via PostMan is great, you can also get a list of the apps.  You using the Chartmuseum API so you can execute operations like DELETE, PUT etc.  The first step is to configure Basic Auth in the PostMan client.  

 

PRO TIP: If you forgot the credentials for Chartmuseum, you can get them by jx rsh into the pod, then executing the following command.

env | grep BASIC

Use the values of the output to fill in POSTMAN Auth.  Once you configure Basic Auth you want to obtain the Charmuseum URL.  THis is done by executing the following command.

jx get urls

The Chartmuseum URL should show as part of the output.  Use that URL to paste it in the URL field of the PostMan client.  The screenshot below shows the result of executing a DELETE on an app called Skipros, and we are deleting the version 0.0.1 only.

Clean up Container Images

Given that you are looking to delete all traces of an app previously deployed to Jenkins X, there is another task you must handle.  This is deleting the container image and all of its tagged versions.  Here is a handy snippet you can use in a bash file.

app_name=skiers

PROJECT=jx-coolproject

IMAGE=$app_name

for TAG in $(gcloud container images list-tags \

    gcr.io/$PROJECT/$IMAGE \

    —format=’get(tags)’)

do

  gcloud container images \

    delete gcr.io/$PROJECT/$IMAGE:$TAG \

    —quiet

done

 

And there you have it, I hope this was helpful.