How to check which plugins are being used by Bamboo plans
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
本記事で説明している手順は、現時点でのものとなります。そのため、一部のお客様で特定の状況下で動作したという報告がありますが、正式にサポートされているわけではなく、お客様の特定のシナリオで動作することを保証するものではありません。
本番環境での実施の前に一通り非本番環境で検証し、成功しなかった場合にはサポートされている代替案にフォール バックしてください。
要約
As some Bamboo instances use many plugins, it is hard to identify which plugin is being used in each plan. In order for us to identify which project/plan is using a specific plugin, we would need to check the data against the database.
環境
All supported Bamboo versions, with plugins installed.
ソリューション
In the database, there's the BUILD table that has a column called XML_DEFINITION_DATA with lots of information in which the plugins are listed.
The queries below were tested against a MySQL and Postgres database. If you use a different database management system, you’ll need to translate the query above into your DBMS’s syntax.
Some of the queries below may fail due to malformed XML data. Please refer to this issue for a workaround: BAM-22073 - Enabling a custom Artifact handler on a Plan breaks the XML on XML_DEFINITION_DATA
- The plugin Information is inside the XML_DEFINITION_DATA, the SQL query will list which Bamboo plan of what project uses which plugin:
SELECT * FROM ( SELECT P.TITLE AS PROJECT,
B.TITLE AS PLAN_KEY,
B.BUILD_TYPE AS BUILD_TYPE,
EXTRACTVALUE(BD.XML_DEFINITION_DATA, '//pluginKey/text()') AS PLUGIN_KEY
FROM BUILD B
JOIN BUILD_DEFINITION BD ON B.BUILD_ID = BD.BUILD_ID
JOIN PROJECT P ON B.PROJECT_ID = P.PROJECT_ID ) AS PLUGIN_USAGE
WHERE ( PLUGIN_KEY IS NOT NULL AND PLUGIN_KEY <> '' )
ORDER BY PROJECT, BUILD_TYPE, PLAN_KEY
SELECT P.TITLE AS PROJECT,
B.TITLE AS PLAN_KEY,
B.BUILD_TYPE AS BUILD_TYPE,
CAST(UNNEST(XPATH('//pluginKey/text()', BD.XML_DEFINITION_DATA::XML)) AS VARCHAR) AS PLUGIN_KEY
FROM BUILD B
JOIN BUILD_DEFINITION BD ON B.BUILD_ID = BD.BUILD_ID
JOIN PROJECT P ON B.PROJECT_ID = P.PROJECT_ID
ORDER BY PROJECT, BUILD_TYPE, PLAN_KEY
SELECT DISTINCT
b.FULL_KEY AS fullkey,
CAST( REPLACE(CAST(XML_DEFINITION_DATA AS VARCHAR(MAX)), 'encoding="UTF-8"', 'encoding="utf-8"'
) AS XML).value('(//*:configuration//*:pluginKey)[1]', 'varchar(max)') AS PLUGIN_KEY
FROM
BUILD_DEFINITION AS bd
JOIN
BUILD AS b
ON
b.BUILD_ID = bd.BUILD_ID
- If you know the plugin’s
keyword
, the query below can be used to return just the plan using that plugin.
SELECT * FROM (SELECT P.TITLE AS PROJECT,
B.FULL_KEY AS PLAN_KEY,
B.BUILD_TYPE AS BUILD_TYPE,
EXTRACTVALUE(BD.XML_DEFINITION_DATA, '//pluginKey/text()') AS PLUGIN_KEY
FROM BUILD B
JOIN BUILD_DEFINITION BD ON B.BUILD_ID = BD.BUILD_ID
JOIN PROJECT P ON B.PROJECT_ID = P.PROJECT_ID) AS PLUGIN_USAGE
WHERE PLUGIN_KEY LIKE ('%plugin keyword%')
ORDER BY PROJECT, BUILD_TYPE, PLAN_KEY
SELECT * FROM (SELECT P.TITLE AS PROJECT,
B.TITLE AS PLAN_KEY,
B.BUILD_TYPE AS BUILD_TYPE,
CAST(UNNEST(XPATH('//pluginKey/text()', BD.XML_DEFINITION_DATA::XML)) AS VARCHAR) AS PLUGIN_KEY
FROM BUILD B
JOIN BUILD_DEFINITION BD ON B.BUILD_ID = BD.BUILD_ID
JOIN PROJECT P ON B.PROJECT_ID = P.PROJECT_ID ) AS PLUGIN_USAGE
WHERE PLUGIN_KEY LIKE ('%plugin keyword%')
ORDER BY PROJECT, BUILD_TYPE, PLAN_KEY
SELECT P.TITLE AS PROJECT,
B.TITLE AS PLAN_KEY,
B.BUILD_TYPE AS BUILD_TYPE
FROM BUILD B
JOIN BUILD_DEFINITION BD ON B.BUILD_ID = BD.BUILD_ID
JOIN PROJECT P ON B.PROJECT_ID = P.PROJECT_ID
WHERE BD.XML_DEFINITION_DATA LIKE '%plugin keyword%'
ORDER BY PROJECT, BUILD_TYPE, PLAN_KEY
Replace the "plugin keyword"
with the keyword of the plugin.
The keyword for the plugin can also be found under the application-properties folder > application.xml file when a Support Zip file is created. For example, Inside the application.xml file, we have listed all plugins installed in Bamboo. The plugin below is the "Atlassian Troubleshooting and Support Tools"
and the keyword is plugin-bamboo.
<plugin>
<key>com.atlassian.troubleshooting.plugin-bamboo</key>
<name>Atlassian Troubleshooting and Support Tools</name>
<version>1.34.3</version>
<vendor>Atlassian</vendor>
<status>ENABLED</status>
<vendor-url>https://atlassian.com</vendor-url>
<framework-version>2</framework-version>
<bundled>Bundled</bundled>
</plugin>