runner icon indicating copy to clipboard operation
runner copied to clipboard

Post job hook is not triggered when Runner is shutdown

Open mochja opened this issue 2 years ago • 4 comments

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:

  1. Define post job hook via ACTIONS_RUNNER_HOOK_JOB_COMPLETED
  2. Start ephemeral runner as SystemD service
  3. Schedule job for this runner
  4. Stop the service using ./svc.sh uninstall while job is being processed by the runner
  5. See that Complete Runner step 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: image

Result when User cancels via GitHub UI: image

In both cases the step results with the same error: image

mochja avatar May 10 '23 02:05 mochja

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.

github-actions[bot] avatar May 13 '24 00:05 github-actions[bot]

Is it possible to enforce this hook for runner shutdown?

mochja avatar May 13 '24 07:05 mochja

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.

crohr avatar Nov 08 '24 19:11 crohr

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.

Image

pidec05 avatar Feb 06 '25 07:02 pidec05