Disk Reclamation Behavior in Bamboo
In Atlassian Bamboo, deleting artifacts via the User Interface (UI) does not trigger an immediate signal to the remote agent to purge the corresponding files from its local disk. Disk space on the agent is reclaimed asynchronously, typically during the next scheduled cleanup task or the execution of a subsequent build for that specific plan.
Confirmed Behavior vs. Likely Mechanism
Confirmed Facts:
- Artifact retention is governed by the "Keep last N builds" or "Cleanup artifacts after build completion" settings.
- Agent-level cleanup is a distinct process configured under
Agent management > [Agent] > Advanced settings.
- The Bamboo server manages the metadata of the artifact; the agent manages the physical file on disk.
Likely Explanation:
To avoid performance degradation and I/O contention during active build windows, Bamboo avoids synchronous "delete" commands from the server to the agent. Instead, the agent maintains a local working directory. When a build starts or a scheduled cleanup runs, the agent compares its local file state against the server's current retention policy and prunes expired directories.
Steps to Ensure Agent Disk Reclamation
To prevent disk saturation when relying on automated policies, implement the following configurations (assuming Bamboo 8.x or similar):
- Enable Agent-Side Cleanup: Navigate to
Agent management, select the specific agent, go to Advanced settings, and enable "Automatically delete old build logs and artifacts from this agent." Set a frequency (e.g., daily) to ensure reclamation occurs regardless of build frequency.
- Configure Plan Retention: In the Plan configuration under
Artifact cleanup, set a strict limit on the number of builds to keep. This ensures that when the agent does sync, it has a clear boundary for deletion.
- Verify Working Directory: Ensure the agent's working directory is on a dedicated partition to prevent a "disk full" event from crashing the host OS.
Verification Commands
To verify if the cleanup is functioning, you can monitor the agent's working directory manually. Replace [agent-home] with the actual path on the agent machine:
# Check disk usage of the bamboo-agent working directory
du -sh [agent-home]/xml-home/bamboo-agent-home/work
# List directories to see if old build IDs persist after UI deletion
ls -l [agent-home]/xml-home/bamboo-agent-home/work
Diagnostic Detail Needed: Are you using a shared working directory across multiple agents on a single host, or does each agent have a unique local path? Shared paths can lead to race conditions during cleanup.