actions / actions/runner

Post job hook is not triggered when Runner is shutdown

Open
#2,595 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the runner shutdown path used when ./svc.sh uninstall stops the SystemD service, and compare it with the cancellation path that runs Complete Job. Reproduce the issue with ACTIONS_RUNNER_HOOK_JOB_COMPLETED on an ephemeral Linux runner. Done means the post-job hook runs during service shutdown as it does when the workflow is cancelled through the GitHub UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions, linux
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.