For one of our deployments we are using a PowerShell script to communicate with Octo’s API to wait for another deploy in another project. We are using an interval on the API to check for it’s IsCompleted property to continue. However, we don’t want the interval to loop forever and instead we want to cancel the current deploy the script is running on. We are able to use the command exit -1 or Throw in the PowerShell script to fail the deploy, but we want to exit with a timeout, so that we are able to see on the Dashboard that the deployment has been timed out.
Is there any way to timeout or cancel a deploy from within a PowerShell step?