Skip to end of banner
Go to start of banner

Managing Build Expiry and Server Storage

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Summary

Bamboo server storage requirements can grow enormously the more builds and deployment plans you are running regularly. Especially if you are running lots of testing builds that log debug information and Selenium screen shots. You can use the Bamboo built-in expiry setting to clean up your instance. However, global expiry can only have one configuration that covers all plans and individual plan expiry overrides are difficult to manage, maintain, and report on to ensure proper setting. 

The following provides a way to easily customize what gets expired (deleted) and when. Artifacts have the biggest storage impact and need to be expired sooner than logs and results. From a management perspective, you want to keep results as long as possible even if the logs need to be expired sooner to save space.  

Details

Build expiry can be managed using new support in Bamboo Command Line Interface (CLI). The new setExpiryOptions action available with Version 9.3 or higher. The following assumes you have configured your Bamboo site or at least your build configuration to run the acli CLI script.

  1. Determine your expiry management criteria in days for each type of data - artifacts, logs, and results (removing a build result also removes artifacts and logs).
  2. Create a build that runs on your own schedule and includes the follow script
Example
#!/bin/bash -x

acli ${bamboo.localSite} -a run --continue \
  -i "-a setExpiryOptions --field artifacts --field expireAfter=2   --field buildsToKeep=5 --field maximumBuildsToKeep=5 --field deploymentsToKeep=5 --field labelsToKeep=keep " \
  -i "-a runBuildExpiry" \
  -i "-a setExpiryOptions --field logs      --field expireAfter=60  --field buildsToKeep=5 --field deploymentsToKeep=5   --field labelsToKeep=keep " \
  -i "-a runBuildExpiry" \
  -i "-a setExpiryOptions --field results   --field expireAfter=120 --field buildsToKeep=5 --field deploymentsToKeep=5   --field labelsToKeep=keep " \
  -i "-a runBuildExpiry"

Configure a global bamboo variable to reference the local Bamboo instance site configuration in your acli configuration properties file that provides authentication. 

View your current global expiry settings to help you determine the last (results) setting. 

Explainer

This script sets Bamboo's global expiry with the custom field settings and then runs the expiry immediately. It repeats this for each of the data types.  

In the example above, we are very aggressive on removing artifacts unless the build has explicitly used the keep label. We keep the results much longer as they do not impact disk space much at all.

To understand the meaning of the field settings, go to the Bamboo global expiry screen or view the Atlassian documentation on this topic.

  • No labels