The 'key' parameter of Calamari bootstrap interferes with deployment scripts

Hello, we’ve recently faced a funny bug (or feature) of Octopus 3.x, which, I believe, we hadn’t on Octopus 2.x. Suddenly, after migration, we’ve started getting failed deployments of a certain project. The error was about “key” variable (which we defined and used in our scripts) having different type. This causes exception and deployment failure. We tried different changes, studies our code, until we’ve tried to verify if “key” variable was defined somewhere else. So we’ve run a simple console script in Octopus script console:

if ($key) {
    Write-Host ('' + $key.GetType() + '   ' + $key)
}
else {
    Write-Host "Key is not defined"
}

Which resulted in “key” variable having non-null value. Investigating further lead us to the Calamari source code: https://github.com/OctopusDeploy/Calamari/blob/master/source/Calamari/Integration/Scripting/WindowsPowerShell/Bootstrap.ps1, where we’ve found what exactly defines the “key” variable.

We’ve fixed build by renaming our “key” variable. But it took us 4 hrs to figure out what was wrong. And, I believe, there will be others who will stumble upon this “feature”. Perhaps it will be even someone from our company :slight_smile: The “key” name is too common and there is a very high chance of picking it up.

It would be great if this issue somehow gets addressed.

Hi Dmitry,

Thanks for getting in touch!

This is a known issue.

Hope that helps!

Henrik

Ok, thanks! We’ll keep an eye on a ticket.