Skip to main content

Execution flow

Direction of execution

Blueprint execution starts with the "Start" action. Because that action is just a marker, we assume it can't fail, which is why the execution flow proceeds to run the next action that is connected to the "OK" port of the "Start" action. Then, depending on whether that action completed successfully it's task, the execution flow is rerouted either through the "OK" or the "KO" port of that action.

"What does it mean 'failed'?" you may ask. It means that the task that the action was supposed to perform didn't perform correctly. Just to name a few possible reasons, it might fail because of network connectivity issues, an error in the provider's API (missing parameter, wrong permissions, etc...), failure while trying to interpolate a variable, etc... The documentation of each action contains a list of reasons that will cause it to reroute the execution flow through the KO port. Generally speaking, the OK port is what you'd call "the happy path" in programming terms.

Ending the execution flow

If the execution flow reaches an action that doesn't have any actions connected to neither of it's ports, the execution flow will terminate. The CLI will exit and the return code will be "0" if the execution flow (of any thread, if you're using threads) ended it's execution on an KO port. It will be "1" otherwise.

That means that if an action reroutes the execution flow through it's KO port and there are no actions connected to that port, no matter what actions other threads might execute, the return code will be "1".

info

You can connect a No op action to the KO port of an action whose task you want to ignore if it fails. This way the return code will still be "0" (if no other actions fail).

Let's continue to the next chapter, where you'll extend your knowledge about the execution flow.