Skip to content

Commit 973b734

Browse files
fix(scorecard): add external plugins to test integration with other plugins and fix jira apiVersion type (#1543)
1 parent 49dfa07 commit 973b734

18 files changed

Lines changed: 642 additions & 52 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-scorecard-backend-module-jira': patch
3+
---
4+
5+
Allow numbers for the configuration jira.apiVersion to work in parallel with another plugin
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
permission:
2+
enabled: false
3+
4+
auth:
5+
environment: production
6+
providers:
7+
github:
8+
production:
9+
clientId: TODO
10+
clientSecret: TODO
11+
signIn:
12+
resolvers:
13+
- resolver: usernameMatchingUserEntityName
14+
15+
catalog:
16+
locations:
17+
- type: file
18+
target: ../../examples/entities.yaml
19+
- type: file
20+
target: ../../examples/github-scorecard-only.yaml
21+
rules:
22+
- allow: [Component]
23+
- type: file
24+
target: ../../examples/jira-scorecard-only.yaml
25+
rules:
26+
- allow: [Component]
27+
- type: file
28+
target: ../../examples/all-scorecards.yaml
29+
rules:
30+
- allow: [Component]
31+
- type: file
32+
target: ../../examples/no-scorecards.yaml
33+
rules:
34+
- allow: [Component]
35+
# TODO: Additional catalog entities for your user
36+
37+
proxy:
38+
'/jira/api':
39+
target: ${JIRA_URL}
40+
headers:
41+
Authorization: ${JIRA_TOKEN}
42+
Accept: 'application/json'
43+
Content-Type: 'application/json'
44+
X-Atlassian-Token: 'nocheck'
45+
User-Agent: 'MY-UA-STRING'
46+
47+
integrations:
48+
github:
49+
- host: github.com
50+
token: TODO
51+
52+
jira:
53+
proxyPath: /jira/api
54+
product: cloud
55+
baseUrl: ${JIRA_URL}
56+
token: ${JIRA_TOKEN}
57+
#apiVersion: 3
58+
59+
scorecard:
60+
plugins:
61+
jira:
62+
open_issues:
63+
options:
64+
mandatoryFilter: Resolution = Unresolved

workspaces/scorecard/app-config.yaml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
jira:
2-
# Required
3-
baseUrl: https://issues.redhat.com
4-
# Required
5-
token: dummy_token
6-
# Required: Supported products: `cloud` or `datacenter`
7-
product: cloud
8-
# By default, the latest version is used. You can omit this prop when using the latest version.
9-
apiVersion: '2'
101
app:
112
title: Scaffolded Backstage App
123
baseUrl: http://localhost:3000
@@ -53,12 +44,28 @@ integrations:
5344
# token: ${GHE_TOKEN}
5445

5546
proxy:
56-
### Example for how to add a proxy endpoint for the frontend.
57-
### A typical reason to do this is to handle HTTPS and CORS for internal services.
58-
# endpoints:
59-
# '/test':
60-
# target: 'https://example.com'
61-
# changeOrigin: true
47+
'/jira/api':
48+
target: ${JIRA_URL}
49+
headers:
50+
Authorization: ${JIRA_TOKEN}
51+
Accept: 'application/json'
52+
Content-Type: 'application/json'
53+
X-Atlassian-Token: 'nocheck'
54+
User-Agent: 'MY-UA-STRING'
55+
56+
# Jira plugin and scorecard configuration
57+
jira:
58+
# optional: Use the proxy configuration above
59+
# proxyPath: /jira/api
60+
61+
# Required
62+
baseUrl: ${JIRA_URL}
63+
# Required
64+
token: ${JIRA_TOKEN}
65+
# Required: Supported products: `cloud` or `datacenter`
66+
product: cloud
67+
# By default, the latest version is used. You can omit this prop when using the latest version.
68+
apiVersion: '2'
6269

6370
# Reference documentation http://backstage.io/docs/features/techdocs/configuration
6471
# Note: After experimenting with basic setup, use CI/CD to generate docs

workspaces/scorecard/examples/all-scorecards.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
annotations:
88
github.com/project-slug: redhat-developer/rhdh-plugins
99
backstage.io/source-location: url:https://github.com/redhat-developer/rhdh-plugins
10-
jira/project-key: RHDHBUGS
10+
jira/project-key: RSPT
1111
spec:
1212
type: service
1313
owner: janus-authors

workspaces/scorecard/examples/jira-scorecard-only.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kind: Component
55
metadata:
66
name: jira-scorecard-only-service
77
annotations:
8-
jira/project-key: RHDHBUGS
8+
jira/project-key: RSPT
99
spec:
1010
type: service
1111
owner: janus-authors

workspaces/scorecard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"lint": "backstage-cli repo lint --since origin/main",
2525
"lint:all": "backstage-cli repo lint",
2626
"prettier:check": "prettier --check .",
27+
"prettier:fix": "prettier --write .",
2728
"new": "backstage-cli new --scope @red-hat-developer-hub",
2829
"postinstall": "cd ../../ && yarn install"
2930
},

workspaces/scorecard/packages/app/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"lint": "backstage-cli package lint"
2020
},
2121
"dependencies": {
22+
"@backstage-community/plugin-github-issues": "^0.13.0",
2223
"@backstage-community/plugin-rbac": "^1.43.0",
2324
"@backstage/app-defaults": "^1.6.5",
2425
"@backstage/catalog-model": "^1.7.5",
@@ -49,6 +50,8 @@
4950
"@material-ui/icons": "^4.9.1",
5051
"@red-hat-developer-hub/backstage-plugin-scorecard": "workspace:^",
5152
"@red-hat-developer-hub/backstage-plugin-theme": "^0.10.0",
53+
"@roadiehq/backstage-plugin-github-pull-requests": "^3.5.1",
54+
"@roadiehq/backstage-plugin-jira": "^2.13.1",
5255
"react": "^18.0.2",
5356
"react-dom": "^18.0.2",
5457
"react-router": "^6.3.0",

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,34 @@ import {
7474
} from '@backstage/plugin-kubernetes';
7575
import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard';
7676

77+
import { GithubIssuesCard } from '@backstage-community/plugin-github-issues';
78+
import { EntityGithubPullRequestsContent } from '@roadiehq/backstage-plugin-github-pull-requests';
79+
import { EntityJiraOverviewCard } from '@roadiehq/backstage-plugin-jira';
80+
7781
const scorecardRoute = (
7882
<EntityLayout.Route path="/scorecard" title="Scorecard">
7983
<EntityScorecardContent />
8084
</EntityLayout.Route>
8185
);
8286

87+
const githubIssuesRoute = (
88+
<EntityLayout.Route path="/github-issues" title="GitHub Issues">
89+
<GithubIssuesCard />
90+
</EntityLayout.Route>
91+
);
92+
93+
const githubPullRequestsRoute = (
94+
<EntityLayout.Route path="/pull-requests" title="Pull Requests">
95+
<EntityGithubPullRequestsContent />
96+
</EntityLayout.Route>
97+
);
98+
99+
const jiraOpenIssuesRoute = (
100+
<EntityLayout.Route path="/jira" title="Jira">
101+
<EntityJiraOverviewCard />
102+
</EntityLayout.Route>
103+
);
104+
83105
const techdocsContent = (
84106
<EntityTechdocsContent>
85107
<TechDocsAddons>
@@ -210,6 +232,9 @@ const serviceEntityPage = (
210232
</EntityLayout.Route>
211233

212234
{scorecardRoute}
235+
{githubIssuesRoute}
236+
{githubPullRequestsRoute}
237+
{jiraOpenIssuesRoute}
213238
</EntityLayout>
214239
);
215240

@@ -247,6 +272,9 @@ const websiteEntityPage = (
247272
</EntityLayout.Route>
248273

249274
{scorecardRoute}
275+
{githubIssuesRoute}
276+
{githubPullRequestsRoute}
277+
{jiraOpenIssuesRoute}
250278
</EntityLayout>
251279
);
252280

@@ -268,6 +296,9 @@ const defaultEntityPage = (
268296
</EntityLayout.Route>
269297

270298
{scorecardRoute}
299+
{githubIssuesRoute}
300+
{githubPullRequestsRoute}
301+
{jiraOpenIssuesRoute}
271302
</EntityLayout>
272303
);
273304

workspaces/scorecard/playwright.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export default defineConfig({
3030
command: 'yarn start',
3131
port: 3000,
3232
reuseExistingServer: false,
33+
env: {
34+
JIRA_URL: 'https://issues.redhat.com',
35+
JIRA_TOKEN: 'my-jira-token',
36+
},
3337
},
3438

3539
retries: process.env.CI ? 2 : 0,

workspaces/scorecard/plugins/scorecard-backend-module-jira/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jira:
4141
# Required: Supported products: `cloud` or `datacenter`
4242
product: cloud
4343
# By default, the latest version is used. You can omit this prop when using the latest version.
44-
apiVersion: '3'
44+
apiVersion: 3
4545
```
4646
4747
## Installation

0 commit comments

Comments
 (0)