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 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.