Update variables in a release via Octopus.Client or directly via REST API

Timur Shagapov's Avatar

Timur Shagapov

01 Dec, 2017 04:05 PM

Hello!
Recently I've added some optional environments in the lifecycle of my projects, but I can't deploy existing releases to new environments unless I manually update variables in those releases. Is there any way to do it via Octopus.Client or REST API?

  1. Support Staff 1 Posted by Michael Compton on 04 Dec, 2017 05:48 AM

    Michael Compton's Avatar

    Hi,

    Thanks for getting in touch. If I understand correctly, you have made a release and deployed it to some environments, now you want to deploy the same release to other environments with different values for the variables. There's a couple of ways to do this.

    Octopus takes a snapshot of the variables when you make a release (so later releases can get different values).

    • You can use the web UI to update the variable values, then click on the release and in 'variable snapshot' select 'update variables', which will overwrite the values.
    • You can use the API to take a new snap shot. There's an example in powershell here
    • You can also use this from C#.

    After a new snapshot has been taken, the following deployments of that release will use the new variable values. If the values are coming from a source you can hook in programatically, then yes you can set the values, take the snapshot and deploy from C#, for example.

    Hope that answers you question. If not, please get back to me.

    Michael

  2. 2 Posted by Timur Shagapov on 04 Dec, 2017 08:47 AM

    Timur Shagapov's Avatar

    Michael, thanks a lot for helping me, I was looking exactly for this API method!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac