In the documentation there is an example given of skipping a step if it has been previously run.
I want to use a slightly different approach, in which a particular step will not be performed if the currently release has already been deployed to the environment.
The run condition that looks like it should work is as follows:
#{if Octopus.Release.Number != Octopus.Release.CurrentForEnvironment.Number}true#{/if}
This however always appears to evaluate as true as the step is always performed, suggesting the variables don’t match. If I execute the below powershell as part of the same step, the variables are identical when redeploying the same release.
Thanks for getting in touch! I’ve run through some tests using this run condition, and it worked just as we were expecting it to. If the last successful deployment to that environment matched the release version I was deploying (an immediate redeploy of the same release), the variable run condition evaluated to false.
Which Octopus version are you currently running?
Were any other releases deployed in between the redeploy?
Could you send us through a copy of your verbose deployment logs with debugging variables enabled? That should shed more light on what could be causing this unexpected result.
I look forward to hearing back and getting to the bottom of this one!
Thanks for coming back to me and testing it on your end. Good to hear it works somewhere
We are currently running Octopus 2018.6.12, in my current test cast no other releases were deployed in between.
I’ve attached my verbose log with the debugging variables enabled, hopefully this might shed some light? ServerTasks-45541.log.txt (28.4 KB)
Weirdly enough, that condition works
It would be good to understand what was wrong with the other one, so I can avoid similar pitfalls in future but I am glad this is now working.