Issue with Prompted Variables used in Runbook Step Run Condition

I have an issue with runbooks when using a prompted variable that is not scoped to the deployment process. This is on version 2019.13.7.

If you have step in the runbook with a variable expression run condition that uses a variable that is scoped exclusively to the runbook it does not seem to be evaluated.

You can easily reproduce it with the following:

  1. Create a new runbook
  2. Add a step with the variable expression run condition of #{PromptedRunbookVariable}
  3. Add a prompted variable PromptedRunbookVariable with a default value of True in the default scope
  4. Run the runbook with the default value and the step will run
  5. Run the runbook and set the variable value to False when prompted. The step does not run which is the expected behaviour :smile:
  6. Scope the variable to just be for the runbook process
  7. Repeat steps 4 but this time the step won’t run :cry:

Screencap demo if it helps https://imgur.com/tsm1lkt

To work around it I’ve chucked a step at the start of the runbook to re-export the variables as step output vars so they can be used in conditional steps.
It ain’t pretty but it works…

$StepName = $OctopusParameters["Octopus.Step.Name"]
$VariableExportPrefix = "Octopus.Action[$StepName].Output."

# Only variables starting with the prefix "RunbookPrompt." will be exported
$Keys = $OctopusParameters.Keys | Where-Object { $_ -like "RunbookPrompt.*" }

ForEach ($Key in $Keys) {
    Write-Host "Exporting variable $Key as $VariableExportPrefix$Key"
    Set-OctopusVariable -Name "$Key" -Value $OctopusParameters[$Key]
}

Hi Shaun,

Thanks for getting in touch and providing those very clear reproduction steps! I’ve been able to repro this in my local instance and I’ve raised the following bug report to get this investigated and fixed.

That’s great to hear you’ve managed to figure out a workaround. I’m very sorry for the inconvenience and confusion this caused, and I appreciate you bringing this to our attention. If you have any questions or concerns moving forward, please don’t hesitate to reach out. :slight_smile:

Best regards,

Kenny

Hi @shaun.lawrie,

We have implemented a fix for this issue, and it should be available for download early next week in the 2020.1.13 release which will be available on octopus.com.

I’ve noted that you are currently running 2019.13. We aren’t intending on building any new versions of 2019.13. It was a ‘fast lane’ release, and was not intended for further patching once a new version was released - in this case 2020.1.

The best path for you to receive this fix will be to upgrade to 2020.1. - is this something you would be comfortable with? The upgrade would also give you access to some of the latest features we have developed. You can review an overview of these here https://octopus.com/downloads/compare?product=OctopusServer&from=2020.1.0&to=2020.1.12

Please let us know if there is anything else we can assist with.

Kind regards,

Andrew.

1 Like