Create a Release that uses the saved settings from another release

I am setting up a process for patching containers. Part of this process has me rebuilding the source code using the code version that had been released to prod most recently. That all works fine.

My issues come when I am releasing it. I am doing a Blue Green deployment model. So, while I am building a patch from the same source, it is entirely probable that the variables in Octopus Deploy have changed during the start of development for the next release (on the alternate Blue/Green deployment pipeline)

I need a way for a release to use the same settings as a previous release, except for the one I need to override (the docker container). I am doing all this from the REST API, so I don’t need the ability from the UI.

Is there a way, via the REST API, to create a release that uses the same version of settings as a previous release?

Hi @OctopusSchaff,

Thanks for getting in touch! Great question, though I don’t believe it would be possible (or at least easy) to create a new release branching from a previous release’s settings only. My first thought to address this would be to suggest something a bit different.

I think the recommended solution here, assuming I’m understanding what you’re after correctly, would be to modify the way you’re modelling your blue-green strategy. A common way to model this is to use separate, but similar, environments (e.g. Prod-Blue & Prod-Green). This allows you to differentiate the variable evaluations per environment (via binding to environment-scoped variables), all within a single release.

Another common way to model this is through multi-tenancy by having a Blue tenant and a Green tenant.

We have a good amount of documentation and knowledge base articles around the blue-green concept and how it can be modelled in Octopus which I’ll link to below in case it’s of any help.

We also have a few projects configured in our samples instance you can reference.

https://samples.octopus.app/app#/Spaces-302/

I hope this helps, and please let me know what you think or if I’m missing any crucial detail on your setup. :slight_smile:

Best regards,

Kenny

I am already modeling my releases via multi-tenancy. It is working very well for me.

I just need some way to deal with releases that need to update the version of the base container when it is updated (ie when the Debian container releases a security update.)

I am wondering if there is a way to do the following via the REST API:

  1. Get a list of all the variable values used for a specific release (with scopes etc)
  2. While making a Release via the REST API, supply overrides for the configured variables.

I think with these two, I can read in the values from the previous release, and then, use those values when creating the release.

Hi @OctopusSchaff,

Thanks for keeping in touch! Great questions, and while I imagine it would certainly be possible to do so via the API, I don’t see any existing scripts in our sample repo that does exactly this. I’m not sure exactly how much would be required in writing this custom script, but I imagine a couple scripts that do exist in the sample repo might provide a good starting point.

Modify or add variable to project:

Import variables from file:

Update release variable snapshot:

I can have a look around internally as well to see if I can find anything else potentially helpful. :slight_smile:

Let me know if you have any questions in the meantime!

Best regards,

Kenny