actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.92k stars 967 forks source link

Post job hook is not triggered when Runner is shutdown #2595

Open mochja opened 1 year ago

mochja commented 1 year ago

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

github-actions[bot] commented 6 months ago

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.

mochja commented 6 months ago

Is it possible to enforce this hook for runner shutdown?

crohr commented 2 weeks ago

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.