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

List Github repositories

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.4
    • Component/s: None
    • Labels:
      None
    • Edition:
      Community
    • Production Notes:
      None

      Description

      Enable the user to see the list of repositories they have access to, by organisation.

      The UI will require the user to select an organization first.

      The list should handle pagination, and clearly flag repositories that have already been imported.

      The user will be required to sign in to github and "authorize" the App (preinstalled by the instance admin, during binding configuration).
      This requires a back-and-forth between SQ and Github. Github will provide a token, that the front-end forwards to the back-end when getting the list of orgs.
      We use this temporary token to get an auth token from github, which is saved for later use: the repositories-fetching calls.

      New API endpoints necessary:

      [GET] api/alm_integrations/get_github_client_id?almSetting=github_binding_1

      Returns the client_id for the almSetting -> required to request the authorization of the GitHub App.

      {
        "clientId": "ID123545"
      }
      

      [GET] api/alm_integrations/list_github_organizations?almSetting=github_binding_1&token=12345

      {
        "organizations": [
           {"key": "SonarSource", "name": "Sonar Source"/* Do we really need the name? */ }
        ]
      }
      

      [GET] api/alm_integrations/list_github_repositories?almSetting=github_binding_1&organization=SonarSource
      The "sqProjectKey" attribute indicates the project key on SQ, if it has already been imported.

      Optionally takes a query param to search for repositories with matching names

      {
        "repositories": [
          {
            "id": 123425,
            "key": "SonarSource/SonarQube", 
            "name": "SonarQube",
            "url": "https://api.github.com/repos/SonarSource/SonarQube",
            "sqProjectKey": "sonarsource/sonarqube"
          }
        ]
      }
      

      Both will handle standard SQ pagination:
      The "p" query parameter (for the page index), and

      "paging": {
        pageIndex: 2,
        pageSize: 100,
        total: 142
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mark.rekveld Mark Rekveld (Inactive)
              Reporter:
              jeremy.davis Jeremy Davis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: