运行 在 Octopus 部署中仅从特定版本开始执行

Run step only from certain version onward in Octopus deploy

我想知道是否有办法 运行 从一个版本开始在 Octopus 中执行特定步骤。

我看到这可以通过定义不同的渠道和一些 "Version Rules" 来实现,但我认为必须有一种方法可以通过 "Run Condition" 在步骤上做到这一点。

我看到here你可以在八达通上比较版本。

我想在我的 "Run Condition":

中定义这样的东西
#{if Octopus.Release.Number > 2.3.15}True{/if}

但是我不知道这个条件具体怎么写。如果你能帮助我,请告诉我。

这是必要的,因为有时我们会向现有部署添加新包(+ 步骤),但旧版本的部署仍在创建中。

提前致谢。

Octostache可以Octostache expressions don't allow logic like this, but you can put that calculation into a script step which outputs的布尔变量evaluat.e

基于我这样解决了我的情况:

在名为 "Check Version" 的 powershell 步骤中,我写道:

$IsOver2315 = $OctopusParameters["Octopus.Release.Number"] -gt [version]"2.3.15"
Set-OctopusVariable -name "IsOver2315" -value (&{If($IsOver2315) {"True"} Else {"False"}})

并且在 "Run Condition" 我写道:

#{Octopus.Action[Check version].Output.IsOver2315}

谢谢benPearce