Workflow Phase Detection

Hello All,

As you can see by the Subject line I’m wondering if there is a way to detect which phase its currently being ran. The reason being I’m working on a script for my job that has to be ran on Post-Provision but also Teardown . At the moment its two scripts but I would like to have it so it’s a single script. I tried searching around the Doc’s and did not see a whole lot unless i missed something. Any help would be apricated.

You can use the <%= instance.status %> variable

During the Post-Provisioning phase it will be set to provisioning
During the Teardown phase it will be set to removing

One thing to keep in mind is if something where to fail during another phase (Ex. The Pre-Provision or Provision phase) this variable is set to “failed”. If you where to then retry the task it would not be set to the expected value.

For that reason I would probably keep it two separate tasks unless completely necessary.

Hope this helps :slight_smile:

1 Like

@Tyler_Boyd Thank you! This helps a lot. I talked with my team and I think we’re just going to go with the two separate scripts. Thanks for the quick reply.