How to extract last build date from all Bamboo plans from the database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Whilst we can get details of build execution from the UI or using the REST API it would be useful if we can get details of the last build for all plans.
Solution
Bamboo will store details of build plan execution within the database table BUILDRESULTSUMMARY
. The following query will return details of the last build execution for all build plans.
1
2
3
4
5
6
7
8
9
10
SELECT BUILD_KEY,
PLAN_NAME,
BUILD_NUMBER,
BUILD_STATE,
BUILD_DATE
FROM BUILDRESULTSUMMARY BRS
WHERE BUILD_TYPE = 'CHAIN'
AND BRS.BUILD_NUMBER = (SELECT MAX(BUILD_NUMBER)
FROM BUILDRESULTSUMMARY BRS1
WHERE BRS.BUILD_KEY = BRS1.BUILD_KEY);
If Bamboo is set to aggressively expire old build results then some build results may be missing. The query will only report on builds that are still within the BUILDRESULTSUMMARY
table.
Was this helpful?