A workflow needs to run two states in parallel, but it’s not clear how to create this in CloudBees CD (CloudBees Flow).
Through the use of a “Broker,” parallel states can be run in CloudBees CD (CloudBees Flow).
However, while these states are run at the same time, only one state can have an exit path.
As illustrated in the above workflow, a Broker state passes the workflow control to State1, then immediately returns to the Broker, which then sends the control of the workflow to State2.
The key to the control of these states and transitions lies mainly in the definition of the transitions as described below.
The first transition out of the broker is an On Completion transition with the Condition set to Always. This will cause the transition to trigger the first time the workflow enters the Broker.
Note that it does not take the “start state2” transition because the condition is not met, which will be discussed in a later step.
The return transition to the Broker is an “On Start” transition, to ensure that it will not wait for State1 to complete but rather transition immediately.
The second transition out of the Broker has a condition set, in this case that the “count” is two, meaning that it has entered the Broker a second time.
This can be used to run any number of states in parallel. Here it is running 5 states in parallel: