Validating that all variables are defined in a deployment

mike's Avatar

mike

19 Feb, 2018 02:23 PM

Hi,

Could we have the option to fail a deployment if variables are undefined?

Ideally, this would include "#{...}" references to variables in the following:

  • Parameter values for a step based on a Step Template
  • Nested references in Variables and Variable Sets (including #{if} subexpressions, etc)
  • File substitutions where they're available.

Most of the undefined variables could be identified before the deployment even starts to execute, although file substitutions might have to be validated as part of the specific deployment step.

For context, I've been troubleshooting an issue with a deployment that appears to be creating incorrect tags in an Azure Resource Manager deployment. When I look in the Azure portal, the resource created by the deployment has a tag called "MyTag" with the literal value "#{MyTag}".

From a quick investigation, it looks like my Octopus Deploy Project doesn't have a variable called "MyTag", so the file substitution on the ARM Template is failing to replace the literal "#{MyTag}" text with the value of a variable. I can obviously fix this by adding a "MyTag" variable to my specific Project, but it doesn't help with the general problem of identifying when variables are undefined in a deployment.

Cheers,

M

  1. Support Staff 1 Posted by Shane Gill on 20 Feb, 2018 12:47 AM

    Shane Gill's Avatar

    Hi Mike,

    Thanks for getting in touch.

    There is an open suggestion in UserVoice to implement your recommendation: https://octopusdeploy.uservoice.com/forums/170787-general/suggestio...

    The best way to get this implemented is to add your support to the UserVoice issue.

    We are currently working on a variable simulator that will get some of the way towards achieving this. You will be able to view evaluated variable values for a particular scope, which will highlight any missing variables in steps and nested references.

    Thanks for the great suggestion.

    Cheers,
    Shane

  2. 2 Posted by mike on 21 Feb, 2018 09:27 AM

    mike's Avatar

    Ah fab, thanks.

    I did try a search here for the same request but didn't find anything, but I'll add my vote to the uservoice ticket.

    Cheers,

    Mike

  3. 3 Posted by mike on 21 Feb, 2018 09:30 AM

    mike's Avatar

    Actually, just to follow up, will the Variable Simulator you mentioned be available through the API? It sounds like a useful feature in itself even if it's UI-only, but it'd have a lot more value if I could automate against it using PowerShell.

  4. Support Staff 4 Posted by Shane Gill on 21 Feb, 2018 09:55 PM

    Shane Gill's Avatar

    Hi Mike,

    Yes, the variable simulator will be available via the API.

    Cheers,
    Shane

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

Generic

? 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