Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Powershell array parameter with default value blocks subsequent parameters
-
In the powershell code shown below, the value for param3 is not received from the plan when the release is executed. Is this a powershell limitation, or something to do with how BuildMaster is parsing the script? If I remove $arr_param, param3 is properly handled.
When the plan is viewed in visual mode, param3 doesn't show up when I edit the test_PS_script Operation. Including a value for arr_param in the plan doesn't change the behavior (although the script does receive the passed in value for arr_param).
SCRIPTASSET - test_PS_script
Param (
$param1,
$param2,
$arr_param = @(),
$param3
)Write-Output "param1: ${param1}"
Write-Output "param2: ${param2}"
Write-Output "arr_param.Count: $($arr_param.count)"
Write-Output "param3: ${param3}"PLAN
PSCall test_PS_script ( param1: val1, param2: val2, param3: val3 );
OUTPUT
Found script test_PS_script.ps1 in Default raft.
Using LocalAgent agent on TESTSERVER01
Importing param3...
Assigning parameter param1...
Assigning parameter param2...
param1: val1
param2: val2
arr_param.Count: 0
param3:
-
After looking into this issue further we have determined that sequentially ordering the parameters will resolve the issue.
Thanks,
Jason