Cause Release/Runbook to Fail when Steps are Skipped

I have Deployments and Runbooks “Succeeding” like this:

When I look closer the main parts of the release, each step says:

Skipping this step as no matching targets were found

I can probably figure out why this happened and fix it and that is not what this question is about (I will ask another if I can’t figure out it).

The hard part is that sometimes I run these deployments/runbooks automatically. And when this happens it shows that the run was a successful. This causes my automation to continue as if everything went right. While there was no “failure”, the run did not work at all.

Is there some way I can get this scenario to cause a failure?

Hi @OctopusSchaff,

My first thought on this one would be to add a script step with the same target roles and have the script check the system variable Octopus.Deployment.Machines. If it returns nothing then return a failure exit code in the script which should then fail the entire deployment.

Regards,
Paul