Manually delete releases

We noticed one of our spaces lifecycle didn’t have a release lifecycle but had a package lifecycle of 45 days. We applied a release lifecycle of 30 days which seems to have made a difference but i’m still seeing files from 75 days ago (04/08/2022).

So two questions:

If you apply a release policy after releases on that lifecycle have been created do those releases get the newly applied release policy?

How can we delete these manually?

Hey @ben.hodges,

Thank you for contacting Octopus Support and sorry to hear you are still seeing releases after applying release retention.

We have a page on retention policies if you have not seen it yet which explains why some releases might not be deleted even if retention is set.

Normally its because the release is still on the dashboard (which means its the current release for an environment). It should also keep the previous release (for rollback purposes).

It looks like you have the release retention policy associated with lifecycles? If so its a bit more complicated but the documentation I linked above goes through example cases of what will and will not be deleted.

If you apply a release policy after releases on that lifecycle have been created do those releases get the newly applied release policy?

In short, if the releases fit the criteria and are not included on the dashboard then yes those releases will be deleted even if they are created before the policy was applied.

How can we delete these manually?

If they are included on the dashboard then you cannot as it will throw errors in the Octopus UI and you will not be able to deploy those releases if required. If they are not active releases and you are sure you want them deleting you can do this manually via the UI (just click on a release you want deleting and go to the three dots at the top of that page and select ‘Delete’).

Or you can do this via the API - we have a script to do this here.

If you have a batch of releases that you want deleting you can do this via the Octopus CLI. We have examples of this here.

Be careful when deleting releases though, make sure you do not want to use them again!

You can also look at your Octopus Task log by selecting ‘Tasks’ at the top of the UI and filtering for any ‘Apply Retention Policy’ tasks as that will show you the retention policy running and will let you know what releases have been deleted (and if they are kept it usually gives you a reason) so you should get a better idea from there on what is / is not being deleted.

I hope that helped but reach out if you need anything further.

Kind Regards,

Clare

Hey Clare,

Sorry didn’t see you’d replied. Yes that’s right, i checked out the retention policies when this issue started and thought the issue was because the lifecycle release retention policy was to keep them forever. This has since been changed to 30 days.

I looked at the task log like you suggested and that shows the release as:
"is a previous release on the dashboard, so it will be kept to allow rollback "

We’re talking about at least hundreds/thousands releases which have been released since and would have replaced the old ones on the dashboard. Why would it think it needs to keep this old one for rollback?

Hey @ben.hodges,

No worries on not seeing the reply, are we able to get a raw task log of the Apply Retention Policy task please so we can have a look and see if we can spot anything. We are thinking there may be some releases associated with some lifecycles that have potentially been deleted and that is why they are not being cleared up but we want to take a deep dive into the logs for that task first before we give you some things to check out.

I have created you a secure link here you can upload the log to when you are free. Let us know once it has been uploaded as we are not notified when customers upload to that secure site.

I look forward to hearing from you,

Kind Regards.
Clare

Hey Clare,

That raw log is all I needed to work out what was happening. Thank you, mystery solved!

thanks,
Ben

Hey @ben.hodges,

Fantastic news the raw log pointed to the issue, just out of curiosity were the releases part of a deleted lifecycle? I only ask because it might be helpful to other users who may be experiencing the same issue and come on our forum for guidance.

Kind Regards,
Clare

Hey Clare,

Sure. So I realised two things from the raw logs and they were all a part of a lifecycle.

The oldest ones which were saying they were part of a rollback which i didn’t believe until i saw how many releases were a part of the lifecycle (about 3). Others had hundreds.

The second problem was i was doing everything right, i just needed to amend the package retention to 30 days as it was currently set to 45.

thanks again for you help.

Hey @ben.hodges,

Thanks for getting back to us and providing that information, it will be valuable to our other customers!

What you said sounds right too, if you have a limited amount of releases for a project it probably wont clean them up on retention so you are able to rollback.

We also recommend when initially setting up retention for the first time on an older instance with a lot of data, to set retention high to start with (as you have done with 45 days) and then lower it steadily, so give it a week on 45 days, then drop it to 30, give it another week etc.

If you have a lot of releases it can take a toll on your Octopus Server if you set retention too low at the start as a lot of your instance resources will be taken up trying to run the retention policy.

So you were setting it up the way we would recommend initially (45 days in your case).

Again thank you for providing us with the fix information, have a good rest of your Friday!

Kind Regards and Happy Deployments,
Clare

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.