Skip to content

Commit 13f5cd2

Browse files
author
Paul Howells
committed
Adding DatasetEntity
Populate custom Dataset entity instead of generic built-in Component Adding custom Catalog Dataset Page Add Schema Card Add Lineage and Quality Card Add Support and Versioning Cards Add Related Resources Card Updates to mapping documentation Update plugin versions to 0.2.0 Updates for README documentation
1 parent 71bc685 commit 13f5cd2

47 files changed

Lines changed: 5518 additions & 507 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BC Data Catalog Gaps.md

Lines changed: 87 additions & 280 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 222 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,226 @@
1-
# [Backstage](https://backstage.io)
1+
# DevHub Backstage Integration for BC Data Catalogue Plugins
22

3-
This is your newly scaffolded Backstage App, Good Luck!
3+
This guide explains how to update the DevHub Backstage project to use the three BC Data Catalogue packages together:
44

5-
To start the app, run:
5+
- `@bcgov/plugin-catalog-backend-module-bc-data-catalogue`
6+
- `@bcgov/plugin-catalog-common-bc-data-catalogue`
7+
- `@bcgov/catalog-dataset`
8+
9+
These packages work together to provide:
10+
11+
- backend ingestion of BC Data Catalogue content into the Backstage catalog
12+
- shared dataset types and utilities
13+
- a frontend dataset page for rendering `Dataset` entities
14+
15+
---
16+
17+
## What Each Package Does
18+
19+
### `@bcgov/plugin-catalog-backend-module-bc-data-catalogue`
20+
21+
Provides the backend catalog module that connects to the BC Data Catalogue and creates catalog entities such as:
22+
23+
- `Dataset`
24+
- `API`
25+
- `System`
26+
- `Group`
27+
- `User`
28+
29+
### `@bcgov/plugin-catalog-common-bc-data-catalogue`
30+
31+
Provides shared types, helpers, and utilities used by the backend and frontend integration.
32+
33+
### `@bcgov/catalog-dataset`
34+
35+
Provides the frontend dataset page and related UI components for rendering `Dataset` entities in DevHub.
36+
37+
---
38+
39+
## Prerequisites
40+
41+
These packages are published to GitHub Packages and require authentication to install, even if the packages are public.
42+
43+
### 1. Create a GitHub Personal Access Token
44+
45+
1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
46+
2. Click **Generate new token (classic)**
47+
3. Give it a descriptive name such as `Backstage Package Access`
48+
4. Select the `read:packages` scope
49+
5. Set a lifespan (90 days or less recommended)
50+
6. Authorize the token for SSO with the `bcgov` organization
51+
7. Copy the token
52+
53+
### 2. Export the Token
54+
55+
```bash
56+
export GITHUB_TOKEN=your_token_here
57+
```
58+
59+
---
60+
61+
## Configure Package Registry Access
62+
63+
### `.npmrc`
664

7-
```sh
8-
yarn install
9-
yarn start
1065
```
66+
@bcgov:registry=https://npm.pkg.github.com
67+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
68+
```
69+
70+
### `.yarnrc.yaml` (if required)
71+
72+
```yaml
73+
npmScopes:
74+
bcgov:
75+
npmRegistryServer: "https://npm.pkg.github.com"
76+
77+
npmRegistries:
78+
"https://npm.pkg.github.com":
79+
npmAuthToken: "${GITHUB_TOKEN}"
80+
```
81+
82+
---
83+
84+
## Install the Packages
85+
86+
```bash
87+
yarn add @bcgov/plugin-catalog-backend-module-bc-data-catalogue
88+
yarn add @bcgov/plugin-catalog-common-bc-data-catalogue
89+
yarn add @bcgov/catalog-dataset
90+
```
91+
92+
---
93+
94+
## Backend Changes
95+
96+
### 1. Register the Backend Module
97+
98+
Update:
99+
100+
`packages/backend/src/index.ts`
101+
102+
```diff
103+
import { createBackend } from '@backstage/backend-defaults';
104+
105+
const backend = createBackend();
106+
107+
// ... other backend.add() calls ...
108+
109+
+ backend.add(import('@bcgov/plugin-catalog-backend-module-bc-data-catalogue'));
110+
111+
backend.start();
112+
```
113+
114+
---
115+
116+
### 2. Allow BC Data Catalogue API Access
117+
118+
Update `app-config.yaml`:
119+
120+
```yaml
121+
backend:
122+
reading:
123+
allow:
124+
- host: catalogue.data.gov.bc.ca
125+
scheme: https
126+
```
127+
128+
---
129+
130+
### 3. Configure Provider Schedule
131+
132+
```yaml
133+
catalog:
134+
providers:
135+
bc-data-catalogue:
136+
env: dev
137+
schedule:
138+
frequency: 10m
139+
```
140+
141+
---
142+
143+
## Frontend Changes
144+
145+
The dataset plugin requires **two changes** in the DevHub frontend.
146+
147+
---
148+
149+
### 1. Add Dataset Route
150+
151+
Update:
152+
153+
`packages/app/src/App.tsx`
154+
155+
```diff
156+
+ import { CatalogDatasetPage } from '@bcgov/catalog-dataset';
157+
158+
const routes = (
159+
<FlatRoutes>
160+
...
161+
+ <Route path="/catalog-dataset" element={<CatalogDatasetPage />} />
162+
</FlatRoutes>
163+
);
164+
```
165+
166+
---
167+
168+
### 2. Register Dataset Page in Entity Switch
169+
170+
Update:
171+
172+
`packages/app/src/components/catalog/EntityPage.tsx`
173+
174+
```diff
175+
+ import { CatalogDatasetPage } from '@bcgov/catalog-dataset';
176+
177+
<EntitySwitch>
178+
<EntitySwitch.Case if={isKind('user')} children={userPage} />
179+
<EntitySwitch.Case if={isKind('system')} children={systemPage} />
180+
<EntitySwitch.Case if={isKind('domain')} children={domainPage} />
181+
182+
+ <EntitySwitch.Case if={isKind('dataset')} children={<CatalogDatasetPage />} />
183+
184+
<EntitySwitch.Case>{defaultEntityPage}</EntitySwitch.Case>
185+
</EntitySwitch>
186+
```
187+
188+
---
189+
190+
## Expected Result
191+
192+
After completing all steps:
193+
194+
- BC Data Catalogue datasets are ingested into Backstage
195+
- `Dataset` entities appear in the catalog
196+
- Selecting a dataset opens the custom dataset page
197+
- Dataset-specific UI (schema, lineage, support, etc.) is rendered
198+
199+
---
200+
201+
## Summary
202+
203+
### Install
204+
205+
- `@bcgov/plugin-catalog-backend-module-bc-data-catalogue`
206+
- `@bcgov/plugin-catalog-common-bc-data-catalogue`
207+
- `@bcgov/catalog-dataset`
208+
209+
### Backend
210+
211+
- Register backend module
212+
- Allow API host
213+
- Configure provider schedule
214+
215+
### Frontend
216+
217+
- Add route in `App.tsx`
218+
- Add EntitySwitch case in `EntityPage.tsx`
219+
220+
---
221+
222+
## Notes
223+
224+
- Keep `GITHUB_TOKEN` out of source control
225+
- Additional hosts may need to be added to `backend.reading.allow`
226+
- The dataset plugin relies on all three packages working together

app-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ backend:
99
reading:
1010
allow:
1111
# Allow BC Data Catalogue host access from backend
12+
- host: api.gov.bc.ca
13+
scheme: https
14+
- host: jh-etk.api.gov.bc.ca
15+
scheme: https
1216
- host: catalogue.data.gov.bc.ca
1317
scheme: https
1418
- host: raw.githubusercontent.com

design/APIsDialog.png

140 KB
Loading

design/DatasetPrototype1.png

246 KB
Loading

design/DatasetPrototype2.png

182 KB
Loading

design/DatasetPrototype3.png

186 KB
Loading

design/DatasetPrototype4.png

170 KB
Loading

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"name": "root",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"engines": {
66
"node": "20 || 22"
77
},
88
"backstage": {
99
"pluginPackages": [
10-
"@bcgov/plugin-catalog-backend-module-bc-data-catalogue"
10+
"@bcgov/plugin-catalog-backend-module-bc-data-catalogue",
11+
"@bcgov/plugin-catalog-common-bc-data-catalogue",
12+
"@bcgov/plugin-catalog-dataset"
1113
]
1214
},
1315
"scripts": {
@@ -55,5 +57,8 @@
5557
"prettier --write"
5658
]
5759
},
58-
"packageManager": "yarn@4.4.1"
60+
"packageManager": "yarn@4.4.1",
61+
"dependencies": {
62+
"@apidevtools/swagger-parser": "^12.1.0"
63+
}
5964
}

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@backstage/plugin-techdocs-react": "^1.3.0",
4040
"@backstage/plugin-user-settings": "^0.8.23",
4141
"@backstage/theme": "^0.6.6",
42+
"@bcgov/plugin-catalog-dataset": "workspace:^",
4243
"@material-ui/core": "^4.12.2",
4344
"@material-ui/icons": "^4.9.1",
4445
"react": "^18.0.2",

0 commit comments

Comments
 (0)