I have a project with several Bash script steps and a very large number of variables.
Some of these variables are sensitive and all of them have multiple scopes.
I cloned this project to a new project that needed the same variables but will target Windows tentacles with a different process.
So I’m replacing the BASH script steps with PowerShell script steps.
The BASH script steps resolved variables using the #{varname} syntax.
In the new project, I am trying to use the $OctopusParameters[‘varname’] syntax for resolving variables.
When I run the new project, the first script step fails with the following output (sensitive info redacted) …
Cannot index into a null array.
At E:\Octopus\Work\20220324125607-332588-366\Bootstrap.ps1:20 char:1
- $tempVar = $OctopusParameters[’********’]
-
+ CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : NullArray
The remote script failed with exit code 1
The action ******** on ******** failed
Through some experimentation, I confirmed that $OctopusParameters is, in fact, NULL
When adding this line …
Write-Host “Octopus Parameters array is null: $($OctopusParameters -eq $Null)”
to the script, it outputs:
Octopus Parameters array is null: True
I have also confirmed this happens whether I run the script on a tentacle or on the Octopus Server.
Plus, I have also confirmed that the #{varname} syntax still resolves the variables properly.
I can use the #{varname} syntax, but for some of my scripts the $OctopusParameters[‘varname’] syntax would be more convenient.
Note: My organization is running Octopus v2020.3.2
I see no reference to a bug fix for this between that version and the latest version (https://octopus.com/downloads/compare?from=2020.3.2&to=2022.1.2121)
Can anyone tell me why $OctopusParameters would be a null array?
Is this an intentional “feature” and if so, why?
Thank you.