Skip to content

[PROTOTYPE] Inform agent-shutdown hook of reason for agent shutdown.#3315

Open
solemnwarning wants to merge 1 commit into
buildkite:mainfrom
solemnwarning:agent-shutdown-reason
Open

[PROTOTYPE] Inform agent-shutdown hook of reason for agent shutdown.#3315
solemnwarning wants to merge 1 commit into
buildkite:mainfrom
solemnwarning:agent-shutdown-reason

Conversation

@solemnwarning

Copy link
Copy Markdown

When running the agent-shutdown hook, the following environment variables may be set:

  • BUILDKITE_AGENT_SHUTDOWN_REASON: The reason the buildkite-agent process is shutting down, "IDLE" for the idle timeout expiring or "SIGNAL" for SIGINT/SIGTERM/etc.

  • BUILDKITE_AGENT_SHUTDOWN_SIGNAL: The signal which caused the agent to shut down (e.g. "SIGINT").

My use case for this is triggering a system shutdown from the agent shutdown hook when the agent has shut down due to inactivity, I can imagine it getting used for other cluster orchestration things too.

See also: https://forum.buildkite.community/t/provide-termination-reason-to-agent-shutdown-hook/4364

When running the agent-shutdown hook, the following environment
variables may be set:

 - BUILDKITE_AGENT_SHUTDOWN_REASON: The reason the buildkite-agent
   process is shutting down, "IDLE" for the idle timeout expiring or
   "SIGNAL" for SIGINT/SIGTERM/etc.

 - BUILDKITE_AGENT_SHUTDOWN_SIGNAL: The signal which caused the agent
   to shut down (e.g. "SIGINT").

My use case for this is triggering a system shutdown from the agent
shutdown hook when the agent has shut down due to inactivity, I can
imagine it getting used for other cluster orchestration things too.
@PriyaSudip PriyaSudip requested a review from SorchaAbel May 14, 2025 23:10
@SorchaAbel SorchaAbel removed their request for review June 16, 2025 23:19
@DrJosh9000 DrJosh9000 added the feature New user-facing feature! label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New user-facing feature!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants