Query to retrieve Linked Repositories which aren't being used in any plans
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
本記事で説明している手順は、現時点でのものとなります。そのため、一部のお客様で特定の状況下で動作したという報告がありますが、正式にサポートされているわけではなく、お客様の特定のシナリオで動作することを保証するものではありません。
本番環境での実施の前に一通り非本番環境で検証し、成功しなかった場合にはサポートされている代替案にフォール バックしてください。
要約
This SQL query will retrieve linked repositories (global ones) that aren't used in any plans (no plans listed under the 用途 tab).
環境
All supported Bamboo versions.
This was tested on Microsoft SQL Server 2019 and Oracle DB server.
ソリューション
select VL.NAME,
VL.VCS_LOCATION_ID,
CONCAT('<BAMBOO_BASE_URL>/admin/editLinkedRepository.action?repositoryId=',VL.VCS_LOCATION_ID) AS EDIT_URL
from VCS_LOCATION VL
where VL.VCS_LOCATION_ID NOT IN
(
select VL.PARENT_ID
from VCS_LOCATION VL
JOIN PLAN_VCS_LOCATION PVL on VL.VCS_LOCATION_ID = PVL.VCS_LOCATION_ID
)
AND VL.IS_GLOBAL = 1
AND VL.MARKED_FOR_DELETION = 0
AND VL.PARENT_ID IS NULL
For your convenience, if you replace <BAMBOO_BASE_URL> with your Bamboo's URL, the third column of the result (EDIT_URL) will contain a direct URL to the web page where you can edit the Linked Repo. If you export it to Excel, you can use the following formula to convert the URL to an Hyperlink. E.g:
=HYPERLINK(C2;C2)
If you use a different DBMS, the above query will need to be translated into your DBMS's syntax.