Skip to content

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

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

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

Conversation

@solemnwarning
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant