Skip to content

Commit 9b6ea45

Browse files
authored
Merge pull request #13 from datum-cloud/feat/github-catalog-integration
feat: pull catalog data and teams from GitHub
2 parents 8b2c171 + 75471d2 commit 9b6ea45

4 files changed

Lines changed: 99 additions & 10 deletions

File tree

app-config.yaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,21 @@ backend:
5959
integrations:
6060
github:
6161
- host: github.com
62-
# This is a Personal Access Token or PAT from GitHub. You can find out how to generate this token, and more information
63-
# about setting up the GitHub integration here: https://backstage.io/docs/integrations/github/locations#configuration
62+
# Local development: a Personal Access Token. Resolves to empty when
63+
# GITHUB_TOKEN is unset, so the integration is simply inactive locally.
64+
# See https://backstage.io/docs/integrations/github/locations#configuration
6465
token: ${GITHUB_TOKEN}
65-
### Example for how to add your GitHub Enterprise instance using the API:
66-
# - host: ghe.example.net
67-
# apiBaseUrl: https://ghe.example.net/api/v3
68-
# token: ${GHE_TOKEN}
66+
# Deployed environments authenticate as a GitHub App instead of a PAT
67+
# (org-wide install, higher rate limits, no personal token to rotate).
68+
# The credentials are already projected into the pod by the
69+
# external-secrets component (backstage-github-app -> GITHUB_APP_*).
70+
# Enable per-environment by supplying this block from the deploy overlay:
71+
# apps:
72+
# - appId: ${GITHUB_APP_ID}
73+
# clientId: ${GITHUB_CLIENT_ID}
74+
# clientSecret: ${GITHUB_CLIENT_SECRET}
75+
# webhookSecret: ${GITHUB_WEBHOOK_SECRET}
76+
# privateKey: ${GITHUB_PRIVATE_KEY}
6977

7078
proxy:
7179
### Example for how to add a proxy endpoint for the frontend.
@@ -126,6 +134,29 @@ catalog:
126134
pullRequestBranchName: backstage-integration
127135
rules:
128136
- allow: [Component, System, API, Resource, Location]
137+
# GitHub as a source of catalog data. Left unset for local dev / e2e (which
138+
# use the file locations below); enable per-environment from the deploy
139+
# overlay, where the GitHub App credentials are available. `github` scans the
140+
# org for catalog-info.yaml (self-declared component/API/dependency facts);
141+
# `githubOrg` imports org members and teams as User/Group entities so
142+
# `owner:` refs resolve to real groups.
143+
# providers:
144+
# github:
145+
# datumCloud:
146+
# organization: datum-cloud
147+
# catalogPath: /catalog-info.yaml
148+
# filters:
149+
# repository: '.*'
150+
# schedule:
151+
# frequency: { minutes: 30 }
152+
# timeout: { minutes: 3 }
153+
# githubOrg:
154+
# - id: datum-cloud
155+
# githubUrl: https://github.com
156+
# orgs: [datum-cloud]
157+
# schedule:
158+
# frequency: { hours: 1 }
159+
# timeout: { minutes: 5 }
129160
locations:
130161
# Local example data, file locations are relative to the backend process, typically `packages/backend`
131162
- type: file

packages/backend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.20",
2727
"@backstage/plugin-auth-node": "^0.7.2",
2828
"@backstage/plugin-catalog-backend": "^3.8.0",
29+
"@backstage/plugin-catalog-backend-module-github": "^0.13.3",
30+
"@backstage/plugin-catalog-backend-module-github-org": "^0.3.23",
2931
"@backstage/plugin-catalog-backend-module-logs": "^0.1.23",
3032
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.21",
3133
"@backstage/plugin-kubernetes-backend": "^0.21.5",

packages/backend/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ backend.add(
3636
import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'),
3737
);
3838

39+
// Discover catalog-info.yaml across the GitHub org and import org users/teams
40+
// as User/Group entities. Both read config from catalog.providers.* and stay
41+
// dormant until that config is supplied per-environment.
42+
backend.add(import('@backstage/plugin-catalog-backend-module-github'));
43+
backend.add(import('@backstage/plugin-catalog-backend-module-github-org'));
44+
3945
// See https://backstage.io/docs/features/software-catalog/configuration#subscribing-to-catalog-errors
4046
backend.add(import('@backstage/plugin-catalog-backend-module-logs'));
4147

yarn.lock

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,6 +2642,47 @@ __metadata:
26422642
languageName: node
26432643
linkType: hard
26442644

2645+
"@backstage/plugin-catalog-backend-module-github-org@npm:^0.3.23":
2646+
version: 0.3.23
2647+
resolution: "@backstage/plugin-catalog-backend-module-github-org@npm:0.3.23"
2648+
dependencies:
2649+
"@backstage/backend-plugin-api": "npm:^1.9.2"
2650+
"@backstage/config": "npm:^1.3.8"
2651+
"@backstage/plugin-catalog-backend-module-github": "npm:^0.13.3"
2652+
"@backstage/plugin-catalog-node": "npm:^2.2.2"
2653+
"@backstage/plugin-events-node": "npm:^0.4.23"
2654+
checksum: 10c0/435f9340db9419a2ee13d444d63f8fda20ed3ab7da1b864a8c02b902e84d8dff7364bbe245ebc39404f9957990ff77dba6d7619d74df5bfb4e329ed3c660a0e9
2655+
languageName: node
2656+
linkType: hard
2657+
2658+
"@backstage/plugin-catalog-backend-module-github@npm:^0.13.3":
2659+
version: 0.13.3
2660+
resolution: "@backstage/plugin-catalog-backend-module-github@npm:0.13.3"
2661+
dependencies:
2662+
"@backstage/backend-plugin-api": "npm:^1.9.2"
2663+
"@backstage/catalog-model": "npm:^1.9.0"
2664+
"@backstage/config": "npm:^1.3.8"
2665+
"@backstage/errors": "npm:^1.3.1"
2666+
"@backstage/integration": "npm:^2.0.3"
2667+
"@backstage/plugin-catalog-common": "npm:^1.1.10"
2668+
"@backstage/plugin-catalog-node": "npm:^2.2.2"
2669+
"@backstage/plugin-events-node": "npm:^0.4.23"
2670+
"@backstage/types": "npm:^1.2.2"
2671+
"@octokit/auth-callback": "npm:^5.0.0"
2672+
"@octokit/core": "npm:^5.2.0"
2673+
"@octokit/graphql": "npm:^7.0.2"
2674+
"@octokit/plugin-retry": "npm:^6.0.0"
2675+
"@octokit/plugin-throttling": "npm:^8.1.3"
2676+
"@octokit/rest": "npm:^19.0.3"
2677+
"@octokit/webhooks-types": "npm:^7.6.1"
2678+
git-url-parse: "npm:^15.0.0"
2679+
lodash: "npm:^4.17.21"
2680+
minimatch: "npm:^10.2.1"
2681+
octokit: "npm:^3.0.0"
2682+
checksum: 10c0/49d17b678117593ca760a243aebff1b92d0d3afb5c9e5246ca7f479f5b755fd1829a82dd5633c228782d1bb9680802e86e6c8d2b83d72a44a77f8c39889a81c7
2683+
languageName: node
2684+
linkType: hard
2685+
26452686
"@backstage/plugin-catalog-backend-module-logs@npm:^0.1.23":
26462687
version: 0.1.23
26472688
resolution: "@backstage/plugin-catalog-backend-module-logs@npm:0.1.23"
@@ -6987,6 +7028,13 @@ __metadata:
69877028
languageName: node
69887029
linkType: hard
69897030

7031+
"@octokit/auth-callback@npm:^5.0.0":
7032+
version: 5.0.1
7033+
resolution: "@octokit/auth-callback@npm:5.0.1"
7034+
checksum: 10c0/851d0930aeecddc626655469ef57727654af30755264d5139d9fdf61ba9fc88c1a8685f5721f853c806c570b8529d25d262f4efe76da90c08c779d9cc1c37edf
7035+
languageName: node
7036+
linkType: hard
7037+
69907038
"@octokit/auth-oauth-app@npm:^5.0.0":
69917039
version: 5.0.6
69927040
resolution: "@octokit/auth-oauth-app@npm:5.0.6"
@@ -7108,7 +7156,7 @@ __metadata:
71087156
languageName: node
71097157
linkType: hard
71107158

7111-
"@octokit/core@npm:^5.0.0":
7159+
"@octokit/core@npm:^5.0.0, @octokit/core@npm:^5.2.0":
71127160
version: 5.2.2
71137161
resolution: "@octokit/core@npm:5.2.2"
71147162
dependencies:
@@ -7155,7 +7203,7 @@ __metadata:
71557203
languageName: node
71567204
linkType: hard
71577205

7158-
"@octokit/graphql@npm:^7.1.0":
7206+
"@octokit/graphql@npm:^7.0.2, @octokit/graphql@npm:^7.1.0":
71597207
version: 7.1.1
71607208
resolution: "@octokit/graphql@npm:7.1.1"
71617209
dependencies:
@@ -7337,7 +7385,7 @@ __metadata:
73377385
languageName: node
73387386
linkType: hard
73397387

7340-
"@octokit/plugin-throttling@npm:^8.0.0":
7388+
"@octokit/plugin-throttling@npm:^8.0.0, @octokit/plugin-throttling@npm:^8.1.3":
73417389
version: 8.2.0
73427390
resolution: "@octokit/plugin-throttling@npm:8.2.0"
73437391
dependencies:
@@ -7482,7 +7530,7 @@ __metadata:
74827530
languageName: node
74837531
linkType: hard
74847532

7485-
"@octokit/webhooks-types@npm:7.6.1":
7533+
"@octokit/webhooks-types@npm:7.6.1, @octokit/webhooks-types@npm:^7.6.1":
74867534
version: 7.6.1
74877535
resolution: "@octokit/webhooks-types@npm:7.6.1"
74887536
checksum: 10c0/7c2cb40f9ccd2bd392cf35c23f995ae0719ef35fd3bce0264ced5518cbf0a7087bd069bf5e5963fc33d0232726968db526912df3cb017c1bd1761c8849c31a30
@@ -13055,6 +13103,8 @@ __metadata:
1305513103
"@backstage/plugin-auth-backend-module-guest-provider": "npm:^0.2.20"
1305613104
"@backstage/plugin-auth-node": "npm:^0.7.2"
1305713105
"@backstage/plugin-catalog-backend": "npm:^3.8.0"
13106+
"@backstage/plugin-catalog-backend-module-github": "npm:^0.13.3"
13107+
"@backstage/plugin-catalog-backend-module-github-org": "npm:^0.3.23"
1305813108
"@backstage/plugin-catalog-backend-module-logs": "npm:^0.1.23"
1305913109
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "npm:^0.2.21"
1306013110
"@backstage/plugin-kubernetes-backend": "npm:^0.21.5"

0 commit comments

Comments
 (0)