Variable Sets -> Variable Template - supply blank value

Short question:

Is there a way of explicitly setting a variable to blank, instead of just leaving the field blank? So I still satisfy Octopus that the variable has been filled in (and not forgotten about) - but the value equates to blank. Something like:

#{Blank}

Longer question for full context:

I have defined a variable set. Let’s call this “VS1”.

Now I add a Variable Template to this set as follows:

  • “InstanceSuffix”

I now set several Projects to include “VS1” as a Library Set. Now all Tenants connected to these Projects are instantly required to supply a value for the variable “InstanceSuffix”. This is exactly what I want - so far so good.

The problem comes where for some Tenants, I want this value to be empty. So some Tenants will need to specify something for that value, and some won’t. If I just leave the field blank though, Octopus quite rightly tells me that I haven’t filled in a value there.

I can get this working if I supply a default value for the variable as follows:

#{if DummyVariable}never_true#{/if}

But it doesn’t feel quite right to me. Ideally I’d like to be able to specify an explicit blank value. So I am still satisfying the fact that I have set a value for that variable - it’s just that the variable happens to be blank.

Is there a good way to do this?

Hi laurence,

Unfortunately, the behavior you’re seeing is by design for safety. We have a somewhat similar workaround that we recommend that you may prefer.

  1. Create a library variable set (or use an existing one)
  2. Make a variable called Blank and leave the value empty
  3. Include the variable set within the project
  4. When you want to have an empty value for a variable, make the value #{Blank}

Implementing a more elegant solution is on our radar, but it’s not on our roadmap.

Sorry I don’t have a better answer for you.

Please let me know if you think this will work for you or if you have more questions or concerns.

Thanks,
Jeremy

Thanks Jeremy. I like your solution better so I’ll give that a go.

1 Like