首页 > 解决方案 > Run step only from certain version onward in Octopus deploy

问题描述

I would like to know if there is a way to run certain step in Octopus from one version onward.

I see this may be achieved by defining different channels and some "Version Rules", but I think there must be a way to do this by a "Run Condition" on the step.

I saw here that you can compare versions on Octopus.

I would like to define something like this in my "Run Condition":

#{if Octopus.Release.Number > 2.3.15}True{/if}

But I don't know exactly how to write this condition. Please let me know if you can help me.

This is necessary because sometimes we add new packages (+ step) to an existing deployment, but deployments for old releases are still being creating.

Thanks in advance.

标签: octopus-deploy

解决方案


根据benPearce 的回答,我解决了这样的情况:

在一个名为“检查版本”的 powershell 步骤中,我写道:

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

在“运行条件”中,我写道:

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

谢谢本皮尔斯


推荐阅读