Post job hook is not triggered when Runner is shutdown
Describe the bug
Seems that Runner skips the Complete Runner step when the SystemD service is stopped during job processing. This behaviour is different from when user cancels the workflow using GitHub UI.
To Reproduce Steps to reproduce the behavior:
- Define post job hook via
ACTIONS_RUNNER_HOOK_JOB_COMPLETED - Start ephemeral runner as SystemD service
- Schedule job for this runner
- Stop the service using
./svc.sh uninstallwhile job is being processed by the runner - See that
Complete Runnerstep was skipped in the Workflow Run
Expected behavior
The Complete Runner step is part of shutdown procedure same as Complete Job step.
Runner Version and Platform
Version of your runner? v2.304.0
OS of the machine running the runner? Linux
What's not working?
Result when stopping the system service:
Result when User cancels via GitHub UI:
In both cases the step results with the same error:
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.
Is it possible to enforce this hook for runner shutdown?
It would be great if this could be supported, as this would allow adding annotations to the job to help the user understand the cause of shutdown. Also for cleaning up if needed.
Is there any update on this issue. We have an ephemeral runner which once started, a job picks it up and start running on it. Now, if runner gets stopped due to some issue(for eg space is full on the runner VM), job gets cancelled and "Complete runner" step does not get executed which causes issues in our dashboard where we are recording each job's result.