Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-20020

(REST) As an admin, I would like to test repository connection from REST API

XMLWordPrintable

    • 0
    • 2
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Issue

      Currently, Bamboo does not provide an endpoint listing repositories (https://jira.atlassian.com/browse/BAM-20007 - (REST) No endpoint available for retrieving Linked Repository ID(s)). Even after gathering the repository ID information, extracted from Bamboo UI or web scraping, testing repository connection still need to much effort from users through REST API.

      How to repository test connection

      Based on Bamboo REST API documentation, there is an endpoint (http://myhost.com:8085/bamboo/rest/api/latest/repository/testConnection [PUT]) in which should provide this information easily, however, it is required to provide not only the repository ID information but also the pluginKey and repositoryURL (when testing connection against Git repository as Repository Host)

      # replace "5341185" with "repository id"
      # replace "file:///nothing" with repository URL
      
      curl -k -u admin:admin \
           -H 'Content-type: application/json' \
           -H 'Accept: application/json' \
           -d '{"repositoryId":"5341185","selectedRepository":"com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-git:gitv2","repository.git.repositoryUrl":"file:///nothing"}' \
           -X PUT http://localhost:8085/rest/api/latest/repository/testConnection
      
      • selectedRepository attribute from payload is not available in Bamboo's UI, making it difficult for user to make use of the endpoint
      • repository.git.repositoryUrl since providing repositoryID information, repository URL seems to be a redundant attribute since repository IDs are unique across Bamboo

      Suggestion

      The endpoint should only consume the repository ID, e.g:

      curl -k -u admin:admin \
           -H 'Accept: application/json' \
           -X PUT http://localhost:8085/rest/api/latest/repository/{repositoryId}/testConnection
      

      As response, Bamboo should provide information about the repository, e.g:

      {
      	"repositoryID": "1234567890",
      	"repositoryName": "Name given in Bamboo"
      	"repositoryHost": "Git",
      	"repositoryURL": "ssh://git@hostname/proj/repository.git",
      	"branch": "master",
      	"testConnection": "Successful"
      }
      

            Unassigned Unassigned
            rsperafico Rafael Sperafico (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: