How to find projects/repositories which have configured a particular plugin/hook.

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: 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 は除く





目的

As a Bitbucket Server administrator you may have need to locate all projects or repositories currently using a particular plugin/hook on your Bitbucket Server instance.

This will work only when a Hook has been configured explicitly for a Repository. Since inherited hooks are applied for all repositories inside a project, they will not show up in the result.


ソリューション

The easiest way to get this data is from the REST API.  Please see the rest endpoint /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks for more details.  You can use name: to search for jenkins in the examples below.

Web hooks after Bitbucket 5.4

To find all hooks for a url for a repository.  Replace '<SLUG>' with the SLUG name:

SELECT repo.name,
       webhooks."URL"
FROM   "AO_A0B856_WEBHOOK" as webhooks
       join REPOSITORY as repo
         ON cast(webhooks."SCOPE_ID" AS INT) = repo.id
WHERE  repo.name = '<SLUG>';


Repository hooks

  • For example, for the Jenkins Webhook Plugin you can run the following SQL query to get the names of all repositories that has the webhook enabled.


    SELECT NAME
    FROM   repository
           JOIN sta_repo_hook
             ON repository.id = sta_repo_hook.repository_id
    WHERE  sta_repo_hook.hook_key LIKE '%jenkins%' 
  • You can run the following SQL query to get the names of all projects that has the webhook enabled.

    SELECT NAME
    FROM   project
           JOIN sta_repo_hook
             ON project.id = sta_repo_hook.project_id
    WHERE  sta_repo_hook.hook_key LIKE '%jenkins%' 

    The above queries were tested against a PostgreSQL database and may need to be altered to match the syntax of your specific database version/vendor.


説明 SQL query to list all repositories and projects using a plugin
製品Bitbucket server

最終更新日 2021 年 7 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.