I am working on a project where we are splitting our octopus deploy server into two. We are cloning the database and restoring on a new server, and deleting a certain amount of resources. However, I am running into issues deleting everything I need to delete because of how Octopus stores data. It seems like there are dependency trees that I need to follow. Would you have any advice on how to do this correctly?
Hey @benjamin.gordon , thanks for reaching out!
You’re right, the mapping of resources can get convoluted pretty quickly
We have a portion of our documentation on syncing instances that specifically discusses the recommended syncing order for resources. The whole page is worth a read as you start to detangle your instances, but the linked portion is especially handy for what you’re looking at right now.
Hopefully that helps, let me know if you have any other questions!
Hey Cory, thanks so much. Have you seen someone do something like this programmatically through the API? Or would my best bet be just doing it by hand. I know it’s possible just not sure if it makes sense, thanks.
If you have a good idea about what you’re specifically working to delete (e.g. - I need to delete everything that has the
MyOldProject lifecycle), the API is a great way to accomplish that sort of automation via filtering the relevant endpoints, then iterating through the results and taking necessary actions.
Something else that can help when you get into writing the scripts is looking at some of the existing scripting examples - they don’t cover every use case, but there’s usually at least an example of how the endpoint is structured and how to work with the responses.
As far as UI vs API, it depends a lot on how much you have to clean up and how much effort you’re willing to expend. I’ve had decent look using the API as a lookup/check script - you can easily get the data, filter to the ones you need to change (and even use the
Links property to give yourself an easy click), then do the actual deletion manually. Rerunning your script will let you know when you’ve actually gotten them all. It’s definitely a little more time consuming, but there are ways to touch on both sides to find the easiest/most efficient path.
I’m coming back to this problem as some higher priority items came up. I’m re-reading through your advice and notice you referred me to documentation on the order to SYNC data, but I need to DELETE data. Would it just be the reverse of the list?