Hi!
I want to set a Run condition based on the output variable of the previous step. The issue that I am running into is that the step runs on N number of machines. Is there any way to iterate over the output variables from each machine with “each” when setting the run condition?
Step 1 will run on N number of remote servers
Step 2 will run on only one server, a different server from any of the servers above
Step 1 will output:
Octopus.Action[Step1].Output[Server-01].Output.VariableToCheck
Octopus.Action[Step1].Output[Server-02].Output.VariableToCheck
etc
Step 2 run condition:
This run condition will work, but does not take into account all potential servers from above:
#{if Octopus.Action[Step1].Output.VariableToCheck == “True”}True#{/if}
No, Step 2 should be run if any of the machines from Step 1 (be == “true”); some machines from Step 1 might (be == “false”) some machines might (be == “true”). If any of the machines (be == “true”), then Step 2 should run.
The other idea is to create a script step in between the first and second. You could use this step to evaluate the variables using PowerShell and output a final true/false variable to be used in the run condition.
Let me know what you think. If you have any further questions, I would be glad to help.
Thanks for getting back to me so quickly! I had already taken the second suggestion from below; I can’t do the first one since I have a dynamic number of machine scoped outputs from the previous step. Glad to know that I wasn’t missing anything – the Run condition doesn’t support the extended variable replacement syntax nor is there such a thing as step scoped outputs in addition to machine scoped outputs.
Thanks for getting back! I’m glad to hear that you already sorted it out! We do have a fairly new UserVoice suggestion to add additional operators to the run condition such as && and ||. The suggestion could use some love.
Feel free to comment and vote. Or look around our other suggestions, there may be one that fits a bit better to what you are after.