Re-deploy existing release but with current variables?

(Pbassett) #1

Is it possible to re-deploy an existing release, but the current library variables?

When using the “Deploy a Release” built-in step, I know that I can override specific variables.

But is there any way to override all variables with their current values?

(Shawn Sesna) #2

When a Release is created, it takes a snapshot of the variables. If variables are updated, it is possible to update the variable snapshot of an existing release.

  • Click on Releases
  • Click on the Release you are wanting to update
  • Click on Update Variables

1 Like
(Pbassett) #3

Is it possible to do that from the calling project (the one with the “Deploy a Release” step)?

Or, barring that, how can I update the variables of a release through the Rest API?

Thank you very much.

(Shawn Sesna) #4

I do not believe it’s an option in the Deploy a Release step, but it’s actually pretty easy using the API. You could do something like,

$OctopusServerUrl = "https://shawnsesna.octopusdemos.app"
$ApiKey = "API-XXXXXXXXXXXXXXXXXXXXXX"

# Call the API to update
$deploymentProcess = Invoke-RestMethod -Method "post" -Uri ("$OctopusServerUrl/api/Spaces-1/releases/Releases-3400/snapshot-variables") -Headers @{"X-Octopus-ApiKey"="$ApiKey"}
#/api/Spaces-1/releases/Releases-3400/snapshot-variables

In that example the Release ID is hardcoded, but you could figure out what it is and then put that in the url for the snapshot command.

1 Like