Refresh vars for all projects using a Variable Set in Octopus


(trond) #1

We have a variable set in Octopus which is used by a large number of projects. Among other things, this variable set contains an api key which we need to update.

Since we use a lot of triggered deploy with immutable infrastructure, we have a lot of “redeploys” of an existing project, so we can’t simply wait for new releases to update to the new variable values.

Is there any way I can trigger a “variable update” on all “currently deployed” releases in all projects that use a certain variable set? I’m dreading the thought of having to spend hours clicking around in Octopus to get stuff updated, that’s nearly an impossible task given our number of projects.

btw I installed the Powershell Octoposh, but that doesn’t seem to work at all against newer Octopus versions. I’m also aware that there is the “octo.exe” tool but I’d very much like to avoid writing any advanced automation on top of an exe file.

Hopefully this is a common enough use-case that somewhere there exists something I can use or build on top of to solve this.


(Daniel Fischer) #3

Hi @trond,

Thanks for getting in touch! Unfortunately this kind of feature does not exist in Octopus. We generally discourage the use of updating variable snapshots for deployments. Octopus generally expects a new release to be created each time a change is made.

Saying that, this is something which is possible through the API. It looks like you only need to POST to /releases/{id}/snapshot-variables where id is the release id. I can give you a link to our open repository of API scripts which you can use as a reference to get your started.

Just note that there is no way to selectively update only a specific variable in the snapshot. So any changes made to the variables in the project, or attached to the project will be applied.

Let me know if you have any further questions or thoughts here. :slight_smile:

Best regards,