我正在使用 Octopus 为我的环境准备好所有先决条件。在章鱼步骤之一中,我希望动态设置一些变量值,为此我使用了章鱼输出变量。
如果我想以数组的形式声明输出变量,它的值不会在我想读取的其他步骤中被读取。
以下是我使用过的几个代码片段(注意:这两个步骤都编写了内联 powershell 脚本代码):
/*Step A code : Set output variable of step code*/
$market= "RO" /*Dynamically identify market depends on machine name */
write-host $market
Set-OctopusVariable -name "TestResult_Domain_['+%market%+']" -value
"DomainNameOfMachine"
/*Another step code*/
$market= "RO" /*Dynamically identify market depends on machine name */
write-host $market
$filterDomain = "Octopus.Action[StepA].Output.TestResult_Domain_['$market']"