Skip to content

Commit a24fa13

Browse files
committed
feat: Add SonarCloud integration
1 parent 5995289 commit a24fa13

File tree

8 files changed

+304
-18
lines changed

8 files changed

+304
-18
lines changed

app-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,9 @@ catalog:
110110
locations:
111111
# Users and Groups
112112
- type: file
113-
target: ../../demo-catalog/organizations/organization-kadras.yml
113+
target: ../../demo-catalog/organizations/organizations.yml
114114
rules:
115115
- allow: [Group, Location, User]
116-
- type: file
117-
target: ../../demo-catalog/organizations/organization-guest.yml
118-
rules:
119-
- allow: [Group, User]
120116

121117
# Templates
122118
- type: file
@@ -164,3 +160,7 @@ search:
164160
highlightAll: false # If true the whole document will be used as the headline, ignoring the preceding three parameters. The default is false.
165161
maxFragments: 0 # Maximum number of text fragments to display. The default value of zero selects a non-fragment-based headline generation method. A value greater than zero selects fragment-based headline generation (see the linked documentation above for more details).
166162
fragmentDelimiter: ' ... ' # Delimiter string used to concatenate fragments. Defaults to " ... ".
163+
164+
sonarqube:
165+
baseUrl: https://sonarcloud.io
166+
apiKey: ${SONARCLOUD_TOKEN}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: backstage.io/v1alpha1
3+
kind: Location
4+
metadata:
5+
name: organizations
6+
description: A collection of Organizations and Users
7+
spec:
8+
targets:
9+
- ./organization-arconia.yml
10+
- ./organization-kadras.yml
11+
- ./users.yml

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@backstage-community/plugin-github-actions": "^0.6.22",
18+
"@backstage-community/plugin-sonarqube": "^0.8.2",
1819
"@backstage/app-defaults": "^1.5.11",
1920
"@backstage/catalog-model": "^1.7.0",
2021
"@backstage/cli": "^0.27.1",

packages/app/src/components/catalog/EntityPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ import {
5757

5858
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
5959
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
60+
import { EntitySonarQubeCard } from '@backstage-community/plugin-sonarqube';
6061

6162
import {
6263
EntityKubernetesContent,
6364
isKubernetesAvailable,
6465
} from '@backstage/plugin-kubernetes';
6566

67+
const MISSING_ANNOTATION_READ_MORE_URL = 'https://backstage.io/docs/features/software-catalog/descriptor';
68+
6669
const techdocsContent = (
6770
<EntityTechdocsContent>
6871
<TechDocsAddons>
@@ -132,6 +135,9 @@ const overviewContent = (
132135
<Grid item md={6}>
133136
<EntityAboutCard variant="gridItem" />
134137
</Grid>
138+
<Grid item md={6}>
139+
<EntitySonarQubeCard variant="gridItem" missingAnnotationReadMoreUrl={MISSING_ANNOTATION_READ_MORE_URL} />
140+
</Grid>
135141
<Grid item md={6} xs={12}>
136142
<EntityCatalogGraphCard variant="gridItem" height={400} />
137143
</Grid>

packages/backend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
1717
},
1818
"dependencies": {
19+
"@backstage-community/plugin-sonarqube-backend": "^0.2.23",
1920
"@backstage/backend-defaults": "^0.5.0",
2021
"@backstage/config": "^1.2.0",
2122
"@backstage/plugin-app-backend": "^0.3.74",

packages/backend/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ backend.add(import('@backstage/plugin-search-backend-module-techdocs/alpha'));
4848
// kubernetes
4949
backend.add(import('@backstage/plugin-kubernetes-backend/alpha'));
5050

51+
// other plugins
52+
backend.add(import('@backstage-community/plugin-sonarqube-backend'));
53+
5154
backend.start();

0 commit comments

Comments
 (0)