Variables are not being picked as expected

Variables are not being picked as expected.

We have a ColorToActivate variable defined in our project, when we deploy the release always blue is the color that gets picked.

Hi @akila.vegesna

Firstly welcome to the community!

Thanks for your question.

Could you provide some more detail, and any relevant screenshots of the variable, and your deployment and what you are seeing?

Please take care to omit any sensitive details, and don’t provide raw task logs as the site is a public forum (although I can make this post private if needed).

Some other questions:

  1. What type of variable is it? Is it just a text variable, a drop-down or a prompted variable?
  2. When you created/updated the variable, did you also create a new release - this is required when making changes to variables, unless you update the variable snapshot associated with an existing release.

Look forward to hearing from you!


We run a check input powershell script to display the variable

      $ColorToActivate = $OctopusParameters["ColorToActivate"].ToLower()
      $OctopusParameters["ColorToActivate"] = $ColorToActivate.ToLower()
      Write-Host "$ColorToActivate will be activated!"

We have to deploy it twice when the color to activate is green.
We make sure once the release is created the preview shows the variable color as intended.

Hi @akila.vegesna

That does indeed sound strange. Looking at your variable definition, it looks like you have set up ColorToActivate as a prompted variable. Is that correct?

When you deploy the release the first time, what value do you enter for the prompted value?
I can see the default is green, so are you changing the default value when deploying for the first time?

And the same question on the second run, what does the value get set to when prompted for the second deployment?

Also, I’m curious on your Check Inputs script, what this line is intended to do:

$OctopusParameters["ColorToActivate"] = $ColorToActivate.ToLower()

The $OctopusParameters is effectively readonly between steps. It’s not possible to change the values from one step to another in that way.

When you say you have to run it twice, it looks like you are deploying using a blue/green approach. Typically you’d need to deploy once per color chosen, so if you wanted to deploy to green, then that would be one deployment, and then another for blue etc.


Hello @mark.harrison,

Before creating the release we change the ColorToActivate variable as either blue/green. We do scheduled releases. so once the variable is changed either to blue/green we create a release and check the snapshot, to make sure the correct variable is defined. That’s not helping us, it still picks blue on a green deployment.

On the day of the scheduled release, Check Inputs(First step of the release process) output from the screen shots I shared before, always blue is chosen as activated color.

We just do a redeploy on the same run. On the second run, green gets picked if its a green deployment.

$OctopusParameters[“ColorToActivate”] = $ColorToActivate.ToLower()

This step is just to make sure the variable value is always lower case.

No, we either do a green deployment or a blue deployment but not both on the same day.

Hi @akila.vegesna

Can you confirm if the variable ColorToActivate is a prompted variable? e.g. does it look a bit like this when you open the editor for the variable:

A prompted variable can have its value chosen at deployment time, this value can override the default provided value in a release if desired?

My only other thought before I pass this to my colleagues in Support is that the value that is being supplied at deployment time is being selected (either typed in manually) or chosen from a drop-down (if that’s the variables control type) and that might be overriding the release variable value.


Yup, its a prompted variable

Hi @akila.vegesna

What type of control type is the variable? Single text box, drop-down?

When you do the deployment, are the users changing the value created at release time? e.g. could this be happening because the value provided at deployment time is the incorrect value?


Control type is not selected on the variable.

But I think its a single text box variable. I monitor the scheduled release and we don’t change the value during the release time.

Hi @akila.vegesna

I’m going to be honest and say I don’t readily know the cause. I asked one of my colleagues to take a look, and he came up with one last possibility that might be causing it. Are there any other variable sets with variables named the same e.g. ColorToActivate that might be conflicting with the project variable?

If you go to the project, choose Variables → All, and then search for the variable name, does it show multiple values - a bit like this:

Another thing to check is to try removing the prompted variable and seeing what happens. An alternative would be to try creating a new variable with a new name to see if that makes any difference.


Hi @akila.vegesna,

I’ve been looking over this with a colleague of mine. Would you be open to hopping on a quick call to go over everything? If so, what is your availability and timezone?


Hello @jeremy.miller,

Yes sure, I work in Central Time Zone and I am available today 11 AM CST - 12 PM CST and 1 PM CST - 5 PM CST.


Let’s plan on 3pm CST. I will send you a zoom link in your DMs for you to join.

Please let me know if you need to change for any reason.


Okay sure.