Closed Clare-Octopus closed 3 months ago
Release Note: Fix a bug where runbooks runs are blocked from being created if there are multiple prompted variable values for the same variable
:tada: The fix for this issue has been released in:
Release stream | Release |
---|---|
2024.3 | 2024.3.7513 |
2024.4+ | all releases |
Severity
Blocking customers from running that runbook, a workaround exists
Version
2023.3.13159, 2024.1.1234-hotfix.1457
Latest Version
I could reproduce the problem in the latest build
What happened?
If you have multiple variable values for a variable name, two bring prompted and one of those prompted variables being unscoped:
And you go to run a runbook with one of those variables included in the process for the runbook, the runbook run errors out with
'An item with the same key has already been added. Key: xxxx'
when running the runbook (you need to make sure you are running it to the same environment as the prompted scoped variable - Production in my example below)The exact same setup works for a deployment, just not a runbook.
Its almost like the runbook is trying to use the
Variable name
rather than theVariable value
and is erroring out because it is the same Key for both.Reproduction
Create a project and create a variable, set it up like in my first screenshot in the 'What Happened' section, ensure you have two prompted variables, one scoped to an environment and one unscoped.
Create a runbook and have a
Run A Script step
in the process and include this in your script -Write-Host "$VariableName"
ieWrite-Host "$DatabaseName"
.Publish the runbook and run it, ensure you select one of the environments that one of the prompted variable values is scoped to.
Run the runbook and you will see the error
'An item with the same key has already been added. Key: xxxx'
.Follow the same process to create a deployment (add a
run a script step
with thewrite host
command) run that deployment to the same environment as above and you will see it deploy with no errors.Error and Stacktrace
More Information
Internal Ticket - https://octopus.zendesk.com/agent/tickets/160799
Workaround
You will need to separate out the unscoped prompted variable and give it its own individual variable name as shown below, this will allow you to run the runbook, you will need to change any scripts you are using or process steps in the runbook to account for the new variable name and value: