从 PowerShell 脚本设置 Octopus 参数

Set Octopus parameter from PowerShell script

我正在使用 Octopus,我需要在我的一个 PowerShell 脚本中添加修改 Octopus 参数(不是变量...)的机会。 简而言之,我的网站交替部署在 2 个文件夹中,我必须对此进行跟踪。我的想法是设置一个参数,在脚本的每个 运行 处读取实际值,因此知道在哪里部署这个新版本。

我也尝试了一些东西,例如

$OctopusParameters['Destination']=$Number

Set-OctopusVariable -Name 'Destination' -Value $Number

但没有成功。

希望我说得够清楚了,谢谢大家的回复。

您可能想尝试为此在机器上设置一个环境变量。它将在部署之间持续存在。

编辑:

不能很好地在评论中格式化,你可能想要这样的东西

$destination = [environment]::GetEnvironmentVariable("Destination","Machine")

// change $destination to its opposite value

[Environment]::SetEnvironmentVariable("Destination",$destination,"Machine")