How to extract all the trigger information for plans from Bamboo database.
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.
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 KB will help provide DB queries to extract all the triggers available on Bamboo plans.
Environment
This has been tested successfully on PostgreSQL DB and might require changes for other databases.
Solution
Below SQL can be used to extract the information.
SELECT P.TITLE AS PROJECT,
B.FULL_KEY,
B.BUILD_ID,
B.BUILDKEY AS BUILDKEY,
B.DESCRIPTION AS BUILD_DESCRIPTION,
CAST(UNNEST(XPATH('/configuration/triggers/triggerDefinition/name/text()', XML_DEFINITION_DATA :: xml)) AS VARCHAR) AS TRIGGER_TYPE
FROM BUILD_DEFINITION BD JOIN BUILD B ON (BD.BUILD_ID = B.BUILD_ID)
JOIN PROJECT P ON (P.PROJECT_ID = B.PROJECT_ID)
ORDER BY 1, 2;