How to maintain variables in Octopus for environments

Lyn Ko's Avatar

Lyn Ko

11 Jan, 2018 02:05 AM

Hi there,

We have a number of variables, variable sets and different environments to scope them against.
I am finding the process of updating/maintaining and ensuring that correct/required variables + scope is defined a bit tedious in Octopus.
Has anyone come across good/easy methods to provide this function???


  1. Support Staff 1 Posted by Nick Josevski on 12 Jan, 2018 02:06 AM

    Nick Josevski's Avatar

    Hello Lyn,

    Thanks for getting in touch.

    If you're using Library Variable sets already that's our current recommendation for managing variables across multiple projects.

    If you're finding the process time consuming through the UI the option is to use the API, where you write some code to iterate over projects and perform the repeated actions that way, we have examples of many API calls in this repository:

    If you share some more specific details of exactly how and why the variables are changing, we may be able to think of something, but it does seem using the API may be your best bet.


  2. 2 Posted by Lyn Ko on 15 Jan, 2018 04:14 AM

    Lyn Ko's Avatar

    Hi there Nick

    We are using variable sets and set variable values depending on the environment scope.

    The main issue I have found is that when a new project is created with variables, the person who creates the variables may miss setting a variable for one environment so one of the tasks before deployment to that particular environment is to ensure all the variables required for that project have been set up for the environment. This is where I find it error-prone and tedious. Esp if there are many variables and environments.

    Have you come across this type of request before and have any examples or pointers on how I can accommodate this?

    I am looking through the repository that you sent to me and the API’s to see if I can work something out. Issue is that I am not a developer so it’s a steeper learning curve.


  3. Support Staff 3 Posted by Nick Josevski on 15 Jan, 2018 04:27 AM

    Nick Josevski's Avatar

    Hi Lyn,

    I see thanks for the details. We have customers solving the "new project" approach by having a few scaffold/example projects, and they start by cloning the most suitable one and then manipulating the new creation.

    When customers are repeatedly creating similar things, we do suggest and hear about them using the API, and yes it would require some development understanding. There's quite a few examples, but I appreciate it will take some time.

    If you go down the API approach, If you hit some specific issues let us know and we can help out, as you hit issues do google searches you'll likely discover forum posts on the Octopus help, or on Stack Overflow that could get you unstuck.


  4. Support Staff 4 Posted by Nick Josevski on 15 Jan, 2018 04:34 AM

    Nick Josevski's Avatar

    Hi again,

    One more thing I forgot to mention, if you're going to start using the API, check out the swagger user interface, we blogged about it here:

    It's an easier way to browse and try start using the API, just add /swaggerui onto the end of your Octopus address.


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


? 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