Elastic Bamboo Agent Scale‑Down: Missing Guaranteed Build Completion Timeout
0 reputation · 18 Dec 2022, 08:03 UTC
0 reputation · 18 Dec 2022, 08:03 UTC
The goal is to ensure that when Bamboo reduces its elastic agent quota, no agent executing a build is terminated before the build finishes.
During a scale‑down event Bamboo attempts to finish current builds, but there is no configurable timeout that guarantees a build will complete; the decision relies on an internal heartbeat mechanism that is not exposed for tuning. The existing bamboo.agent.idle.timeout.minutes setting only applies to idle agents and does not protect busy agents.
What is the maximum time Bamboo will wait for a running build to finish before terminating an agent during scale‑down?
Can the internal heartbeat interval be adjusted to extend the wait period for active builds?
Is there a way to enforce a graceful drain period for busy agents when the elastic quota is reduced?
33275 reputation · 18 Dec 2022, 12:37 UTC
There is no configurable maximum wait time. During a scale-down, Bamboo waits for a running build to finish (or be cancelled) before deprovisioning the elastic agent — the wait is bounded only by the build's own duration. The internal heartbeat is hard-coded in the agent binary and cannot be tuned, and there is no built-in graceful-drain setting for busy agents. The only related knob, bamboo.agent.idle.timeout.minutes, applies exclusively to agents that are already idle.
Confirmed behavior (Bamboo releases up to late 2026):
bamboo.cfg.xml entry exposes it.bamboo.agent.idle.timeout.minutes governs how long an idle agent lingers before shutdown. It has no effect on an agent mid-build.Inferred / undocumented: the heartbeat interval itself is not documented; empirical observation of agent logs suggests roughly five minutes, but this is not guaranteed and could change between releases. Treat any specific number as unverified.
Because the wait is unbounded, a hung or pathologically long build will pin an agent indefinitely, keeping your elastic bill running. Since you cannot enforce a drain period server-side, the realistic mitigations are:
bamboo.agent.idle.timeout.minutes low (e.g. 5–10) so agents are deprovisioned promptly after their build finishes, which is the only phase you can control.sleep 1800 script task) on an elastic agent.atlassian-bamboo-agent.log) for heartbeat timestamps to confirm the interval on your version.bamboo.agent.idle.timeout.minutes, rerun, and confirm the agent is deprovisioned quickly once the build ends — and that the setting changed nothing while the build was running.This reflects Bamboo behavior through releases available as of September 2026. Atlassian could add scale-down or drain controls in later versions, so check the release notes for your exact version before relying on this. If you observe an agent being killed mid-build during scale-down, that would contradict the expected behavior — in that case, the Bamboo server log lines around the termination event would be the diagnostic detail needed to say more.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.