How to find historical deployment records in Bamboo
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
This article outlines a couple of methods you can use to find historical deployment records in Bamboo, even if the deployment releases have expired already.
Global expiry can be set to remove complete build & deployment results, build & release artifacts and all logs but it will never remove historical deployment records.
Environment
The solution has been validated in Bamboo 9.5 and Bamboo 9.6 but may be applicable to other versions.
Solution
Historical deployment records can be found in the Bamboo UI and the database even if deployment results, release artifacts, and logs have already been removed. You can use one of the following approaches to find historical deployment records:
Solution 1 – Bamboo UI
- Go to the Deploy > All Deployment Projects > select a Deployment Project > Releases tab.
- You'll see all of the historical records for that deployment project under the History section.
Solution 2 – Database/ SQL
The following select query will provide you with a list of historical records for a particular deployment project. The list will include details such as the deployment project name, release name, name of the release branch, the key of the plan associated to that release as well as its build number.
Bamboo 9.5 and earlier versions:
SELECT DP.NAME AS deployment_project_name,
DP.PLAN_KEY AS plan_key,
DE.NAME AS deployment_environment,
DV.NAME AS release_name,
DV.PLAN_BRANCH_NAME AS release_branch,
DVPRK.BUILD_NUMBER AS build_number,
DVI.NAME AS artifact_name,
DR.DEPLOYMENT_STATE AS deployment_state,
DR.LIFE_CYCLE_STATE AS lifecycle_state,
DR.STARTED_DATE AS started_date,
DR.QUEUED_DATE AS queued_date,
DR.EXECUTED_DATE AS executed_date,
DR.FINISHED_DATE AS finished_date
FROM DEPLOYMENT_PROJECT DP
LEFT JOIN DEPLOYMENT_VERSION DV
ON DP.DEPLOYMENT_PROJECT_ID = DV.PROJECT_ID
LEFT JOIN DEPLOYMENT_RESULT DR
ON DV.DEPLOYMENT_VERSION_ID = DR.VERSION_ID
LEFT JOIN DEPLOYMENT_ENVIRONMENT DE
ON DR.ENVIRONMENT_ID = DE.ENVIRONMENT_ID
LEFT JOIN DEPLOYMENT_VERSION_ITEM DVI
ON DV.DEPLOYMENT_VERSION_ID = DVI.DEPLOYMENT_VERSION_ID
LEFT JOIN DEP_VERSION_PLANRESULTKEYS DVPRK
ON DV.DEPLOYMENT_VERSION_ID = DVPRK.DEPLOYMENT_VERSION_ID
WHERE DP.NAME = '<DEPLOYMENT_PROJECT_NAME>'
ORDER BY deployment_project_name,
started_date DESC NULLS LAST,
finished_date,
release_name DESC
You'll need to replace <DEPLOYMENT_PROJECT_NAME> in the query with the actual deployment project name.
Bamboo 9.6 and later versions:
SELECT DP.NAME AS deployment_project_name,
DP.PLAN_KEY AS plan_key,
DE.NAME AS deployment_environment,
DV.NAME AS release_name,
DV.PLAN_BRANCH_NAME AS release_branch,
DVPRK.BUILD_NUMBER AS build_number,
A.LABEL AS artifact_name,
DR.DEPLOYMENT_STATE AS deployment_state,
DR.LIFE_CYCLE_STATE AS lifecycle_state,
DR.STARTED_DATE AS started_date,
DR.QUEUED_DATE AS queued_date,
DR.EXECUTED_DATE AS executed_date,
DR.FINISHED_DATE AS finished_date
FROM DEPLOYMENT_PROJECT DP
LEFT JOIN DEPLOYMENT_VERSION DV
ON DP.DEPLOYMENT_PROJECT_ID = DV.PROJECT_ID
LEFT JOIN DEPLOYMENT_RESULT DR
ON DV.DEPLOYMENT_VERSION_ID = DR.VERSION_ID
LEFT JOIN DEPLOYMENT_ENVIRONMENT DE
ON DR.ENVIRONMENT_ID = DE.ENVIRONMENT_ID
LEFT JOIN DEPLOYMENT_VERSION_ARTIFACT DVA
ON DV.DEPLOYMENT_VERSION_ID = DVA.DEPLOYMENT_VERSION_ID
LEFT JOIN ARTIFACT A
ON A.ARTIFACT_ID = DVA.ARTIFACT_ID
LEFT JOIN DEP_VERSION_PLANRESULTKEYS DVPRK
ON DV.DEPLOYMENT_VERSION_ID = DVPRK.DEPLOYMENT_VERSION_ID
WHERE DP.NAME = '<DEPLOYMENT_PROJECT_NAME>'
ORDER BY deployment_project_name,
started_date DESC NULLS LAST,
finished_date,
release_name DESC
You'll need to replace <DEPLOYMENT_PROJECT_NAME> in the query with the actual deployment project name.
Example
In the example below, notice that the BSP-CASE plan had generated two artifacts used on release-7 (before that it only had one) and that release-1 and 2's dates are being reported as null because those Deployment results were already expired, so Bamboo no longer have that information
deployment_project_name | plan_key | deployment_environment | release_name | release_branch | build_number | artifact_name | deployment_state | lifecycle_state | started_date | queued_date | executed_date | finished_date |
---|---|---|---|---|---|---|---|---|---|---|---|---|
My Deployment project | BSP-CASE | production | release-7 | main | 9 | first_artifact | Successful | Finished | 2023-02-07 16:47:44.611 | 2023-02-07 16:47:44.629 | 2023-02-07 16:47:44.721 | 2023-02-07 16:47:45.024 |
My Deployment project | BSP-CASE | production | release-7 | main | 9 | second_artifact | Successful | Finished | 2023-02-07 16:47:44.611 | 2023-02-07 16:47:44.629 | 2023-02-07 16:47:44.721 | 2023-02-07 16:47:45.024 |
My Deployment project | BSP-CASE | production | release-6 | main | 8 | first_artifact | Successful | Finished | 2022-10-29 15:24:19.498 | 2022-10-29 15:24:19.518 | 2022-10-29 15:24:19.775 | 2022-10-29 15:24:05.661 |
My Deployment project | BSP-CASE | production | release-5 | main | 7 | first_artifact | Failed | Finished | 2022-10-29 15:22:53.41 | 2022-10-29 15:22:53.43 | 2022-10-29 15:22:54.091 | 2022-10-29 15:22:13.514 |
My Deployment project | BSP-CASE | production | release-4 | main | 6 | first_artifact | Successful | Finished | 2022-09-28 09:23:24.141 | 2022-09-28 09:23:24.381 | 2022-09-28 09:23:25.096 | 2022-09-28 09:23:25.204 |
My Deployment project | BSP-CASE | production | release-3 | main | 5 | first_artifact | Successful | Finished | 2022-07-22 14:35:13.493 | 2022-07-22 14:35:13.533 | 2022-07-22 14:35:13.7 | 2022-07-22 14:35:13.859 |
My Deployment project | BSP-CASE | development | release-2 | main | 4 | first_artifact | [ null ] | [ null ] | [ null ] | [ null ] | [ null ] | [ null ] |
My Deployment project | BSP-CASE | development | release-1 | main | 3 | first_artifact | [ null ] | [ null ] | [ null ] | [ null ] | [ null ] | [ null ] |