Update sonarqube plugin's README.md to reflect recent changes

No more use for proxy configuration

Optional instance name in project annotations

Signed-off-by: Neemys <36508659+Neemys@users.noreply.github.com>
This commit is contained in:
Neemys
2022-06-17 17:46:52 +02:00
parent f9c310a439
commit 4d0fc08d4b
+5 -39
View File
@@ -33,50 +33,14 @@ yarn add --cwd packages/app @backstage/plugin-sonarqube
);
```
3. Add the proxy config:
Provide a method for your Backstage backend to get to your SonarQube API end point. Add configuration to your `app-config.yaml` file depending on the product you use. Make sure to keep the trailing colon after the `SONARQUBE_TOKEN`, it is required to call
the Web API (see [docs](https://docs.sonarqube.org/latest/extend/web-api/)).
**SonarCloud**
```yaml
proxy:
'/sonarqube':
target: https://sonarcloud.io/api
allowedMethods: ['GET']
# note that the colon after the token is required
auth: '${SONARQUBE_TOKEN}:'
# Environmental variable: SONARQUBE_TOKEN
# Fetch the sonar-auth-token from https://sonarcloud.io/account/security/
```
**SonarQube**
```yaml
proxy:
'/sonarqube':
target: https://your.sonarqube.instance.com/api
allowedMethods: ['GET']
# note that the colon after the token is required
auth: '${SONARQUBE_TOKEN}:'
# Environmental variable: SONARQUBE_TOKEN
# Fetch the sonar-auth-token from https://sonarcloud.io/account/security/
sonarQube:
baseUrl: https://your.sonarqube.instance.com
```
4. Get and provide `SONARQUBE_TOKEN` as an env variable (https://sonarcloud.io/account/security or https://docs.sonarqube.org/latest/user-guide/user-token/).
5. Run the following commands in the root folder of the project to install and compile the changes.
3. Run the following commands in the root folder of the project to install and compile the changes.
```yaml
yarn install
yarn tsc
```
6. Add the `sonarqube.org/project-key` annotation to the `catalog-info.yaml` file of the target repo for which code quality analysis is needed.
4. Add the `sonarqube.org/project-key` annotation to the `catalog-info.yaml` file of the target repo for which code quality analysis is needed.
```yaml
apiVersion: backstage.io/v1alpha1
@@ -86,9 +50,11 @@ metadata:
description: |
Backstage is an open-source developer portal that puts the developer experience first.
annotations:
sonarqube.org/project-key: YOUR_PROJECT_KEY
sonarqube.org/project-key: YOUR_INSTANCE_NAME/YOUR_PROJECT_KEY
spec:
type: library
owner: CNCF
lifecycle: experimental
```
`YOUR_INSTANCE_NAME/` is optional and will query the default instance if not provided.