Browse Source

SONAR-11769 Update docs for GHE PR analysis

tags/7.7
MikeBirnstiehl 5 years ago
parent
commit
2777740597

+ 15
- 19
server/sonar-docs/src/pages/analysis/pull-request.md View File

@@ -43,33 +43,29 @@ These parameters enable PR analysis:
### Pull Request Decoration
To activate PR decoration, you need to:

* declare an Authentication Token
* specify the Pull Request provider
* feed some provider-specific parameters
* (For GitHub <!-- sonarqube -->Enterprise<!-- /sonarqube -->) Specify your pull request provider<!-- sonarqube -->, create a GitHub App and configure your SonarQube instance,<!-- /sonarqube --> and set your GitHub parameters.
* (For Azure DevOps and Bitbucket) Specify your pull request provider and set an authentication token/personal access token.

#### Authentication Token
<!-- sonarqube -->
The first thing to configure is the authentication token that will be used by {instance} to decorate the PRs. This can be configured in **Administration > General Settings > Pull Requests**. The field to configure depends on the provider.
For GitHub Enterprise or GitHub.com, you need to configure the **Authentication token** field. For Azure DevOps or Bitbucket Server, this is the **Personal access token**.
<!-- /sonarqube -->
<!-- sonarcloud -->
If you are using Azure DevOps, the first thing to configure is the authentication token that will be used by {instance} to decorate the PRs. This can be configured in **Administration > General Settings > Pull Requests > VSTS > Personal access token**.
<!-- /sonarcloud -->

#### Pull Request Provider
#### Specifying Your Pull Request Provider
| Parameter Name | Description |
| --------------------- | ------------------ |
| `sonar.pullrequest.provider` | `github`, `vsts` <!-- sonarcloud -->or `bitbucketcloud`<!-- /sonarcloud --><!-- sonarqube -->or `bitbucketserver`<!-- /sonarqube -->. This is the name of the system managing your PR. In Azure DevOps, when the {instance} Extension for Azure DevOps is used, `sonar.pullrequest.provider` is automatically populated with "vsts". <!-- sonarcloud -->Same on GitHub if you are using the Travis CI Add-on, and on Bitbucket Cloud if you are building with Bitbucket Pipelines.<!-- /sonarcloud -->|
| `sonar.pullrequest.provider` | `github` or `vsts` <!-- sonarcloud -->or `bitbucketcloud`<!-- /sonarcloud -->. This is the name of the system managing your PR. In Azure DevOps, when the {instance} Extension for Azure DevOps is used, `sonar.pullrequest.provider` is automatically populated with "vsts". <!-- sonarcloud -->Same on GitHub if you are using the Travis CI Add-on, and on Bitbucket Cloud if you are building with Bitbucket Pipelines.<!-- /sonarcloud -->|

Note: if you were relying on the GitHub Plugin, its properties are no longer required and they must be removed from your configuration: `sonar.analysis.mode`, `sonar.github.repository`, `sonar.github.pullRequest`, `sonar.github.oauth`.

#### GitHub Parameters
<!-- sonarqube -->
#### Creating Your GitHub App
To add PR decoration to Checks in GitHub Enterprise, an instance administrator needs to create a GitHub App and configure your SonarQube instance. See [GitHub Enterprise Integration](/instance-administration/github-application/) for more information.
<!-- /sonarqube -->

#### Setting Your GitHub Parameters
| Parameter Name | Description |
| --------------------- | ------------------ |
| `sonar.pullrequest.github.repository` | SLUG of the GitHub Repo |
<!-- sonarqube -->
| `sonar.pullrequest.github.endpoint` | The API URL for your GitHub instance.<br/> Ex.: `https://api.github.com/` or `https://github.company.com/api/v3/` |
<!-- /sonarqube -->

Note: if you were relying on the GitHub Plugin, its properties are no longer required and they must be removed from your configuration: `sonar.analysis.mode`, `sonar.github.repository`, `sonar.github.pullRequest`, `sonar.github.oauth`.
#### Setting Your Authentication Token/Personal Access Token

If you are using Azure DevOps or Bitbucket, you need to configure the authentication token/personal access token that will be used by {instance} to decorate the PRs. This can be configured in **Administration > General Settings > Pull Requests > VSTS > Personal access token**.

<!-- sonarcloud -->
#### Bitbucket Cloud Parameters

+ 58
- 0
server/sonar-docs/src/pages/instance-administration/github-application.md View File

@@ -0,0 +1,58 @@
---
title: GitHub Enterprise Integration
url: /instance-administration/github-application/
---
_GitHub Enterprise Integration is available as part of [Developer Edition](https://redirect.sonarsource.com/editions/developer.html) and [above](https://www.sonarsource.com/plans-and-pricing/)._

## Adding Pull Request Decoration to GitHub Checks

You can add Pull Request decoration to Checks in GitHub Enterprise by creating a GitHub Application, configuring your SonarQube instance, and installing the app in your organizations.

### Creating a GitHub Application

Click [here](https://developer.github.com/apps/building-github-apps/creating-a-github-app/) for general instructions on creating a GitHub App.

From the "Register new GitHub App" page, follow these steps to create your GitHub App for PR decoration:

1. Under **GitHub App name**, give your app a name (such as SonarQubePRChecks).
2. GitHub requires a **Homepage URL** and a **Webhook URL**. These values aren't important for Pull Request decoration, so you can use any URL (such as https://www.sonarqube.org/).
3. Set the following "Permissions" to **Read & write**:
* Checks
* _Developer Edition v7.2+ Only_: Pull requests (Note: This is only needed to clean up PR decoration in GitHub Conversation. PR decoration in Checks is replacing PR decoration in Conversation.)
* Commit statuses
4. Under "Where can this GitHub App be installed?," select **Any account**.
5. Click **Create GitHub App**.

### Generating and Setting Your Private Key

After creating your app, you'll be prompted with a link to "generate a private key" at the top of the page. Click the link to download your .pem private key file. You can also download your .pem file by scrolling down to "Private Key" and clicking **Generate Private Key**.

After downloading your .pem file, you'll need to set your private key at a global level in SonarQube by following these steps:

1. Generate a base64 encoded string with your .pem private key file using `base64 -w0 /path/to/key.pem` on Linux or `base64 -i /path/to/key.pem` on MacOS.
2. Copy and paste the base64-encoded content of your private key file into the text box at [**Administration > Pull Requests > GitHub > GitHub App private key**](/#sonarqube-admin#/sonarqube/admin/settings?category=pull_request/).

### Configuring Your SonarQube Instance

You'll need to configure the following settings at a global level in SonarQube.

#### Setting Your GitHub Enterprise Instance API URL

Enter your GitHub Enterprise Instance API URL in the text box at [**Administration > Pull Requests > GitHub > GitHub API URL**](/#sonarqube-admin#/sonarqube/admin/settings?category=pull_request/).
Your GitHub Enterprise instance API URL is formatted as follows: `https://<your-github-enterprise-address>/api/v3`

#### Setting Your App Name and ID
1. Enter your app name in the text box at [**Administration > Pull Requests > GitHub > GitHub App name**](/#sonarqube-admin#/sonarqube/admin/settings?category=pull_request/).
2. Enter your app ID in the text box at [**Administration > Pull Requests > GitHub > GitHub App ID**](/#sonarqube-admin#/sonarqube/admin/settings?category=pull_request/). You can find your GitHub App ID on the app's settings page at `https://<your-github-enterprise>/settings/apps/<appname>`.

### Installing Your App

To install your app in your organizations:

1. Go to your GitHub App URL.
* GitHub App URLs are specific to your GitHub Enterprise Address and your app name and are formatted as follows: `https://<your-github-enterprise-address>/github-apps/<YourAppName>`.
* For example, if your GitHub Enterprise address is `github-enterprise-1.yoursite.com` and your app name is `SonarQubePRChecks`, your GitHub App URL will be `https://github-enterprise-1.yoursite.com/github-apps/SonarQubePRChecks`.
2. From your GitHub App page, click the **Install** or **Configure** button.
3. Choose the organization where you want to install your app from the list.
4. Click the **Install** button.

+ 5
- 0
server/sonar-docs/src/pages/requirements/requirements.md View File

@@ -80,6 +80,11 @@ To get the full experience SonarQube has to offer, you must enable JavaScript in
| Opera | ![](/images/exclamation.svg) Not tested |
| Safari | ![](/images/check.svg) Latest |

<!-- sonarqube -->
## GitHub Enterprise Integration
To add Pull Request analysis to Checks in GitHub Enterprise, you must be running GitHub Enterprise version 2.14+.
<!-- /sonarqube -->

## Platform notes
### Linux
If you're running on Linux, you must ensure that:

+ 1
- 0
server/sonar-docs/static/SonarQubeNavigationTree.json View File

@@ -71,6 +71,7 @@
"/instance-administration/quality-profiles/",
"/instance-administration/security/",
"/instance-administration/delegated-auth/",
"/instance-administration/github-application/",
"/instance-administration/look-and-feel/",
"/instance-administration/marketplace/",
"/instance-administration/housekeeping/",

+ 1
- 0
server/sonar-docs/static/StaticNavigationTree.json View File

@@ -87,6 +87,7 @@
"/instance-administration/quality-profiles/",
"/instance-administration/security/",
"/instance-administration/delegated-auth/",
"/instance-administration/github-application/",
"/instance-administration/look-and-feel/",
"/instance-administration/marketplace/",
"/instance-administration/housekeeping/",

Loading…
Cancel
Save