Forcefully fail/retry a step for particular machine

Hi,
I understand there is a Guided failure for scenario where it fails and we want to introduce manual intervention. This works like a charm when there is an error visible to Octopus. But what if a step is stuck for a long time due to an internal error and is not visible to Octopus? Is there a way for Octopus to ignore it and move forward or at least fail that step for particular machine.
For example, if a step is executing for 5 machines in parallel and it is completed for 4 machines but stuck in 1 machine for long time and it has failed internally and not visible to Octopus, what can be done?
To be specific, in my case a batch file runs and there is a manual intervention required due to internal error and hence Octopus doesn’t think it as an error
Please help

Hi Pratik,

Thanks for getting in touch.

Unfortunately we have no way of time-limiting script execution currently. There is an existing uservoice you could vote for, which seems to describe this same issue.

As a possible workaround, if you’re running a PowerShell script to trigger this batch file from Octopus, you can Start-Process and wait for it to exit, and if it hasn’t exited after X time, throw an exception. So you can implement your own timeout via custom scripting.

In PowerShell, the commands to search for would most likely be a combination of Start-Process and Wait-Process.

Eg: Something like this could be done in PowerShell:

$maximumRuntimeSeconds = 30

$process = Start-Process -FilePath '[path-to-your-batch-file]'

try
{
    $process | Wait-Process -Timeout $maximumRuntimeSeconds -ErrorAction Stop
    Write-Warning -Message 'Process successfully completed within timeout.'
}
catch
{
    Write-Warning -Message 'Process exceeded timeout, will be killed now.'
    $process | Stop-Process -Force
}

Hope this helps.

Cheers
Mark