How to get a list of deployment environments that contain a specific variable from the Bamboo database
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
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.
You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.
We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!
Summary
This article will show you how to get a list of deployment environments that contain a specific variable from the Bamboo database.
Environment
Bamboo 7, 8 and 9
Solution
Use the following SQL to gather all deployment environments that contain a specific variable:
SELECT DP.NAME AS "DEPLOYMENT_PROJECT",
DE.NAME AS "ENVIRONMENT"
FROM DEPLOYMENT_ENVIRONMENT DE
JOIN DEPLOYMENT_PROJECT DP ON DE.PACKAGE_DEFINITION_ID = DP.DEPLOYMENT_PROJECT_ID
JOIN VARIABLE_DEFINITION VD ON DE.ENVIRONMENT_ID = VD.ENVIRONMENT_ID
WHERE VARIABLE_KEY = 'variable_to_search'
AND VARIABLE_VALUE = 'variable_value_to_search';
Change variable_to_search and variable_value_to_search for the variable name and value you want to search in the database for.