Flow Control Mechanism

The Flow Control Mechanism is used to control the flow of the Build Plan in a linear way, for example you can use it to restart a Build Plan from a step that failed in a previous job or to skip a few steps in a special case

A Flow Control step is an OGFS or Server script that prints specific key words (grouped as a section) that are interpreted by the Build Plan Runner as a Flow Control instruction. For example:

Begin Flow Control:
        
	Forward to step 16
        
End Flow Control
        

The Forward to step value instruction, instructs the Build Plan runner to continue with a forward step (it cannot go backwards or return to the same step). Accepted values for this instruction:

X Where X is a positive integer, will make the Build Plan runner to continue with Build Plan step X - absolute step number
+X Where X is again a positive integer. Default: no steps are skipped, This value makes the Build Plan Runner jump forward relative to the current step - relative step number. For example, the value +1 causes a jump to the next step. The value +2 causes the next step to be skipped (jump to the second step following the current step).
$END Causes the Build Plan to finish execution.

Note: You cannot have negative integer values or strings other than $END.

If you specify an invalid Build Plan step, the Build Plan ignores the instruction and finishes execution.

The Flow Control section once found is removed from the script output so it is not be printed in the Build Plan output.

To help with the implementation of Flow Control Scripts, both for OGFS and Server scripts, use the following environment variables

BUILD_PLAN_ID the current Build Plan ID
TARGET_SERVER_ID the current target server ID
CURRENT_STEP_NO the currently running Build Plan step number

SA provides a sample step and a sample Build Plan that you can use to understand how flow control works.

  • The sample Continue with previous job run failed step must be the first step of a Build Plan. It generates a flow control statement that causes the Build Plan to forward to the step where it last failed on the same server. The step has no effect if the Build Plan has not been run previously ran or if it succeeded.
NOTE: The step does not take into consideration any Build Plan changes, so if the steps changed since the last run, you could get unexpected results, as the step will forward to a step that may be different than the one at which the Build Plan previously failed.
  • The Build Plan SAMPLE: Flow Control Restart from failed step is an example of how Continue with previous job run failed step should be used. Rerun the sample Build Plan until it finishes successfully to see what the first step does.