Organizing variables

Everett Muniz's Avatar

Everett Muniz

11 Jan, 2018 08:14 PM

I'm migrating a deployment process into Octopus Deploy. In general, I have 2 kinds of variable: (1) variables that are exclusively for Octopus Deploy - I think of these as deployment variables - and (2) variables that are appSettings, connectionStrings or other configuration - I think of these as application configuration variables. I'd like to group these variables in the variable UI and my first thought for how to do this is to use a special character as the first character for the Octopus Deploy / deployment variables. For instance, all of my deployment variables would start with tilde: ~Site.HostName, ~Site.IP, etc.

Is there a recommended approach for grouping variables as described above? If the approach I described makes sense, is there a safe character to use as the prefix? I tried '@', '$' and '&' and variables that began with those characters were NOT replaced when included in another variable. Tilde worked though. For instance, a variable value defined as "database=#{$Database.Name};server=#{$Database.Server};" was not updated with the values of the $Database.Name and $Database.Server variables. However, "database=#{~Database.Name};server=#{~Database.Server};" was updated with the values of the ~Database.Name and ~Database.Server variables.

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

    Nick Josevski's Avatar

    Hello,

    Thanks for getting in touch. We would advise against using symbols as a prefix, and to just instead name space them as a convention in your projects. Pick a short namespace a few letters or short words.

    Example:
    - App.DbConnection - Od.OctopusRelatedVariable

    I see you using Site. you can continue with that doesn't need a symbol prefix, which may lead to unexpected issues and be more confusing.

    The only other thing I can mention is we have had this suggestion come up, so if you would like to vote on it and add more details, it's here on User Voice: https://octopusdeploy.uservoice.com/forums/170787-general/suggestio...

    Regards,
    Nick

  2. 2 Posted by Everett Muniz on 12 Jan, 2018 03:48 AM

    Everett Muniz's Avatar

    I thought that the symbol prefix might be a bad idea...The problem for us with OD. and App. namespace oriented approach is that many of the App. variable names correspond to appSettings which don't currently have a prefix. For instance, the application has an appSetting with the key 'DataTool/RoleID'. As I understand it, If I want Octopus Deploy to update this appSetting then my variable has to be named 'DataTool/RoleID'. Is that right?

  3. Support Staff 3 Posted by Nick Josevski on 15 Jan, 2018 02:39 AM

    Nick Josevski's Avatar

    Hello,

    Yes you're right, the variables that are used in appSettings would need to remain unchanged and match exactly how they are there.

    In this scenario only first class support for grouping and arranging would help, like what I linked to as a feature suggestion on User Voice.

    If you can namespace the other variables, then only the app settings one will be the different ones, but can appreciate it won't be sorted/grouped completely now.

    Regards,
    Nick

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