How do I get a step to only run on a deployment trigger?

Hi,

We have a step that we need to only run when an Octopus Deployment target trigger is run. We auto-scale our servers in Production every so often, and we need to build in a pause in our deployment process to wait for an item to complete.

So, how do I run a step when it’s using a named trigger of AutoScale?

Hi,

Thanks so much for getting in touch.

In your Pause script, the first thing I’d do is to scope it to only Production. This will mean that the step can only ever run in your Production environment

The next step is to use a Run Condition of #{if Octopus.Deployment.Trigger.Name == “AutoScale”}True#{/if}

This is assuming that your Trigger is called AutoScale.

Configured Step:

In the deployment process, you can see that the deployment hasn’t run the Pause step as it’s not been evaluated as “True”.

When the new targets are added, you can see that the Pause step runs successfully with the Run Conditions specified.

If for instance, your deployment target trigger is called “Autoscaling for Production”, then the run condition variable expression would be #{if Octopus.Deployment.Trigger.Name == “Autoscaling for Production”}True#{/if}

Please let me know if you have any questions,

Thanks,

Derek