Code Sharing (PowerShell): Update Octopus variable via Octopus API

The trace-ability features when linking between Octopus and TFS/VSTS work pretty well out of the box, especially when using the Octopus Deploy build extension. When Releases are created by a build, there is a link in the Release description that points back to the build that created it. There is also a section in the build results that points to the Octopus release that was created. This met most of my needs, but to take it a step further and reference builds/files/artifacts during deploy time, I decided to use the Octopus Deploy API. I wanted to update Octopus variables as part of the build process before a Release is created so that deploy steps could link back to builds/files/artifacts that were versioned during build.

The following script doesn’t have to be used to reference builds, it can be used to update any Octopus variable at all. I’ll let my comments do the talking. Please post in the comment section with any questions or enhancements you may have.

3 thoughts on “Code Sharing (PowerShell): Update Octopus variable via Octopus API

Leave a Reply

Your email address will not be published. Required fields are marked *