Configuring global expiry
Global expiry allows you to manage the timing for when build and deployment artifacts should be deleted from your Bamboo system.
You may want to consider doing this for the following reasons:
- Build and deployment artifacts can be large, and so consume storage on your system. Your system may run out of disk space if artifacts no longer in active use are retained indefinitely.
- Large numbers of builds and deployments clutter the Bamboo user interface, and may reduce performance, making it slower to work with Bamboo.
See this Atlassian blog post for a discussion of using build expiry and labels.
Global expiry applies to all build plans and deployment projects, and is generally the easiest way to manage artifacts expiry in Bamboo.
However, note that:
You can configure build expiry for individual build plans to override the global expiry settings. You can not yet override the global expiry configuration for particular deployment projects.
- You can also delete the results of a plan build manually.
A Bamboo administrator can configure global expiry for both build and deployment artifacts as described below.
Expiry is limited to the Bamboo server itself and does not apply to remote agents, and there's no other option to help manage the disk space on remote agents besides configuring 'Delete build directories after a build'.
Configure global expiry
Ensure that you back up any build results data before their expiry date is reached.
To enable and configure global expiry:
- Click theicon in the Bamboo header and choose Overview.
- Click Expiry (under 'Plans') in the left-hand navigation panel.
- If necessary, enable deployment expiry. Note that this can not be reversed – see the Bamboo 5.7 upgrade notes.
- Click Edit.
Configure global expiry using the following settings:
Complete build & deployment results...
All build results data (including artifacts and build logs), and deployment results and release artifacts, are deleted.
Build and release artifacts
Only user-defined artifacts are deleted.
Build and deployment result logs
Only build logs and deployment result logs are deleted. Note that logs can be excluded from expiry based on size.
Specifies the age (days, weeks or months) that build and deployment results must reach before they are deleted.
For example, specify '24 months' to keep results created in the last two years.
Maximum builds to keep
Specifies the maximum number of results you want to keep.
Minimum builds to keep
Specifies the minimum number of results you want to keep.
For example, specify '50' to keep the latest 50 build results, even if they are older than the age specified with Expire after.
Keep builds with the following labels
Specifies the build labels (not plan labels or job labels) applied to builds for which you want to keep build results, regardless of the Expire after and Minimum builds to keep settings. Note that builds can be labeled either manually or automatically.
Minimum deployments to keep
Specifies the minimum number of successful deployments to keep, even if they are older than the age specified with Expire after. The minimum value is 2.
- Click the icon to the right of 'Schedule' to set when the expiry event will be triggered. You can specify a cron expression if required. See this FAQ for help constructing cron expressions.
- Click Save.
The global expiry event runs periodically (as determined by the expiry Schedule), regardless of whether you disable or enable expiry for your build and deployment results. When this event occurs, your build and deployment results will be expired according to the global and plan settings you have made.
Calculating the expiry date
This section outlines how the ages of build or deployment results are calculated so as to determine when they should be expired.
Build results and all logs
The ages of build results, build logs, and deployment logs are simply calculated from their respective creation dates.
If the age of the build result or log is equal to or greater than the Expire after age, then it is deleted when the expiry event occurs (assuming build results or logs are configured for deletion).
Note that logs can be excluded from expiry based on size.
Build and deployment artifacts
The ages of build and deployment artifacts are calculated as follows:
- If there is no release associated with the build result, then use the build result creation date.
- Otherwise, if the build result has never been deployed, then use the creation date for the latest release that refers to it.
- Otherwise, use the creation date for the latest deployment.
If the age of the build or deployment artifact is equal to or greater than the Expire after age, then it is deleted when the expiry event occurs (assuming artifacts are configured for deletion).