0

I want to retrieve the list of repos inside a Bitbucket project that are using a particular plugin.

I have gone through the REST API documentation for Bitbucket but I can't seem to find a way to do it.

Using this, I can get the plugin information for only one repo.

http://bitbucket.org.com/rest/api/1.0/projects/$ProjectKey/repos/$RepoKey/settings/hooks/com.trimble.tekla.TeamCityTriggerHook-SonarFix:TeamcityTriggerHook

Is there a way with that I can retrieve all the repos using a particular (in my case Sonar Fix Teamcity TriggerHook plugin)?

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
ANIL
  • 2,542
  • 4
  • 25
  • 44

1 Answers1

1

Execute the following:

for r in $(curl -s --user USER:PASS --request GET https://BITBUCKET-SERVER/rest/api/1.0/projects/PROJECT/repos | jq --raw-output '.values[].slug')
do
    hook=$(curl -s --user USER:PASS --request GET https://BITBUCKET-SERVER/rest/api/1.0/projects/GP/repos/$r/settings/hooks/com.trimble.tekla.TeamCityTriggerHook-SonarFix:TeamcityTriggerHook | jq --raw-output '.enabled')
    echo -n "$r => $hook"
    echo ""
done

To get something like this:

REPO1 => true
REPO2 => false
REPO3 => true
...