How to delete a release?

Hi, I would like to know how to delete a release. I don’t see any way to accomplish this. Just want to clear it out and start fresh but not re-create my Application.

Thanks

Hi @CodedInk,

You can delete the release using the line below:

curl 'https://api.balena-cloud.com/v5/release(123456789)' -X DELETE -H 'authorization: Bearer <YOUR_TOKEN> 

It would be a good idea to also check that you don’t have any device on that release, although the API should check for this.

Cheers.

2 Likes

This is how you delete it from the Balena Cloud Dashboard?

@CodedInk yes, that will delete the target release.

Pleased to hear it helped you!

It’s been a while since this was first asked, but just curious: is there any chance this could be added to the Balena Dashboard UI as well? We have a number of old CI builds that it would be nice to clean up.

Cheers,

Adam

4 Likes

As a quick note, there is a chance that this curl command will cause your device to experience issues, particularly if there are supposed to be deltas between a deleted release and a new release. We are discussing adding a “delete release” feature and will keep this thread updated. In the meantime, there is a Supervisor fix which we will be working on which might resolve the immediate issue I mentioned, of deltas from or to a deleted release: https://github.com/balena-os/balena-supervisor/issues/1616, but in the meantime, please be careful!

Cheers,
Christina

EDIT: The Supervisor issue mentioned above has been resolved with Supervisor v12.9.6, which you may upgrade to via self-serve upgrades.

Just recently had a problem where I had to delete some failed releases, but there is a newer API version so here is what I got:

curl --location --request DELETE 'https://api.balena-cloud.com/v6/release?$filter=belongs_to__application%20eq%20<APP_ID>%20and%20commit%20eq%20%27<COMMIT_HASH>%27' \
--header 'Authorization: Bearer <AUTH_TOKEN>'

I have a big problem with a release and I’m unable to delete. Please help a newbie:

What have I to do? What terminal (PC?) and what to fill in in what order? I don’t find APP-ID and COMMIT_HASH and AUTH_TOKEN

I would like to delete the last release because it doesn’t start anymore. I’m unable to repair because I always get the message that it is up to date if I try to update. If it is deleted I can build a new one. Please help as I can’t use my TTS V3 Balena Cloud Gateway furthermore.

You should be able to do this from any terminal with curl in it. If you are on windows, I would suggest using WSL for this.(Or if you want to you can also use Postman, but I wouldn’t.)

APP-ID: The APP-ID can be found on the Fleets tab, it’s the number where it says FLEET ID

COMMIT_HASH: You can get this when you go to the Releases tab inside your application, on the left there is a column titled Commit, that column contains the COMMIT_HASH for that specific release. There is a handy copy button next to it as well.

AUTH_TOKEN: For this one you need to go to your profile preferences, and under Access tokens create an API token.

Hope the instructions are clear, and you will be able to fix your gateway.

OK, just to be clear: I started a terminal session under MacOS and logged in to my Balena account using web browser. After that I fired the command with filled in values for APP_ID, COMMIT_HASH and AUTH_TOKEN (a very large key), all without “<>”. After that nothing happens, no error or success message. Release to be deleted is still present, not deleted. And now?

It doesn’t really give a meaningful response, just keep trying, you might have missed something, it took me way longer to do it properly than I anticipated. When you do it successfully, the release should be gone instantly.

Now, I always get the message : "Malformed url: ‘/resin/rer=belongs_to__application%20eq%201878094%20and%20commit%20eq%20%27806c452%27’

OK, I found the mistake. But it seems not to work, I only get the message “OK” but the release is still there.

I did another mistake: Only transmitted the first 7 numbers of COMMIT_HASH.
Now, I transmitted the whole hash and get the message: Data is referenced by device. And the release is still not deleted. What can I do?

Edit: I got it deleted. I first had to de-pin the release from my device.
Thank you very much for your help.

1 Like

@hasch Glad to hear you eventually managed to delete it!

@arcsi Thanks for jumping in with suggestions here, much appreciated :slight_smile:

1 Like

Yes, I succeeded deleting the faulty release thanks to the help of this forum.

I also would like to see the possibility to delete a release via the UI. Using command-line is possible, but hard to apply. It is easy to make mistakes, and is time consuming. You need to figure out first how it is working. When developers creating multiple (internal) releases for test-purposes, the number of releases growths. A clean-up of the releases by deleting older and unused versions is preferred. This should be possible via UI.

Hi @jveijck I’d suggest submitting this as a feature request on our public roadmap at https://roadmap.balena.io :+1:

1 Like

Hi everyone, as of version 18.11.0 of the dashboard, it is now possible to delete a release via the dashboard UI. You can find the feature in the Modify dropdown of the releases table or on the Settings page for a release. Along with this feature getting shipped, it is also now possible to delete fleets that were previously unable to be deleted as a result of having had a device moved to another fleet and that device still running the old fleet’s release. Thank you to everyone who asked for this feature and to everyone who voted for it on https://roadmap.balena.io/. We look forward to hearing more of your feedback and seeing more suggestions on the roadmap!

1 Like