Run condition: Output Variable for N Number of Machines in Previous Step

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?

I’m using:
Octopus 3.13.7



Thanks for reaching out. I’d like to get a better understanding of your scenario to be able to help you with this.

Is the step that’s going to be running with the condition (step 2) going to run on the same amount of machines as the previous step (step 1)?


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:

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}

Hope this helps!

~ Katie

So the condition for step 2 to run is that it must succeed (be == “true”) on all the machines from Step 1?

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.

~ Katie

Hi Katrina,

Thanks for getting back with that information. It looks like we don’t have the ability to evaluate multiple Boolean output variables as an OR.

There are a couple of option here that will let you work around this.

The first would be to create another variable like the following: #{if var1}true{/if}#{if var2}true{/if}. Which will return blank if both are false, or true if one is true, or truetrue if both are true, which is still evaluates as true.

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.

Best regards,

Hi Daniel,

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 again!

~ Katie

Hi Katie,

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. :slight_smile:

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.

Let me know what you think.

Best regards,