Trondh
Trondh

Reputation: 3351

Refresh vars for all projects using a Variable Set in Octopus

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.

Upvotes: 3

Views: 1264

Answers (1)

ryan.rousseau
ryan.rousseau

Reputation: 1665

You can do this by writing a script that composes the underlying API requests into one action.

You can find some documentation on the API at https://demo.octopus.com/swaggerui/index.html

The Dashboard endpoint will give you the current release that is deployed in each environment for each project.

It may be easier to keep track of which projects you want to refresh, but you can query the projects endpoint for project details including what variable sets are included.

From there you can use the releases/{id}/snapshot-variables endpoint to refresh the variables for that release.

There are examples of using the API at https://github.com/OctopusDeploy/OctopusDeploy-Api

Upvotes: 1

Related Questions