Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-13987

Validate administrator configuration for BitBucket Server

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.6
    • Component/s: Branch & PR
    • Labels:
      None
    • Edition:
      Developer
    • Production Notes:
      None

      Description

      We want to improve the Bitbucket Server integration by checking the validity of the configuration as early as possible.

      HOW

      Create and use a new API endpoint common for all 4 ALMs POST api/alm_settings/validate?key=xxx

      This endpoint will return an empty 200 code if everything is alright, or a 400 code with a message as plaintext detailing what issue is detected.

      To validate that Bitbucket Server is properly configured, on the endpoint implementation, we want to verify the connectivity, the authentication, and the permissions. Here are the Bitbucket Server endpoints to call to achieve that:

      • Validate authentication
      • Url validation: /rest/api/1.0/repos as anonymous
      • PAT validation: /rest/api/1.0/users with a bearer token
      • validate permissions
      • Read projects & repos permissions:
        • /rest/api/1.0/repos (check repos permission is enough, projects permission are inherited and can’t be lower than repo permission)
      • PR write permission:
        • Solution 1: /rest/api/1.0/repos?permission=REPO_WRITE (check that there is at least one result). Downside is that it works only if there is at least one repository...

       

       

      UI

      When saving a configuration (be it new or edited), the modal hosting the form will be closed, and validation automatically triggered.

      A call is made to api/alm_settings/validate?key=[configuration_key].

      The configuration will be shown as "being validated", and then the status will be updated when we get a response.

      • In case of success, we show a message and check mark with the status for each feature (PR decoration & import)
      • In case of error, the reason ( best effort regarding its precision ) is clearly stated for the user, in order to help them fix whatever the issue is.

      This validation can be manually triggered by pressing a button.


      When loading the page, all existing configurations are re-validated following the above pattern, with the following exception:

      • in case of success, no success message is displayed, only the valid status.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pierre.guillot Pierre Guillot
              Reporter:
              pierre.guillot Pierre Guillot
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: