This guide explains how to update the DevHub Backstage project to use the three BC Data Catalogue packages together:
@bcgov/plugin-catalog-backend-module-bc-data-catalogue@bcgov/plugin-catalog-common-bc-data-catalogue@bcgov/catalog-dataset
These packages work together to provide:
- backend ingestion of BC Data Catalogue content into the Backstage catalog
- shared dataset types and utilities
- a frontend dataset page for rendering
Datasetentities
Provides the backend catalog module that connects to the BC Data Catalogue and creates catalog entities such as:
DatasetAPISystemGroupUser
Provides shared types, helpers, and utilities used by the backend and frontend integration.
Provides the frontend dataset page and related UI components for rendering Dataset entities in DevHub.
These packages are published to both npmjs.org and GitHub Packages using a GitHub Actions workflow in the APS-DevOps repository.
If you are installing the packages from npmjs.org, no additional configuration or authentication is required.
If you choose to pull from GitHub Packages, follow these steps to authenticate, as it is required even for public packages:
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token (classic)
- Give it a descriptive name such as
Backstage Package Access - Select the
read:packagesscope - Set a lifespan (90 days or less recommended)
- Authorize the token for SSO with the
bcgovorganization - Copy the token
export GITHUB_TOKEN=your_token_hereThe following configuration is only required if you are pulling the packages from the GitHub registry instead of npmjs.org.
@bcgov:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
npmScopes:
bcgov:
npmRegistryServer: "https://npm.pkg.github.com"
npmRegistries:
"https://npm.pkg.github.com":
npmAuthToken: "${GITHUB_TOKEN:-}"yarn add @bcgov/plugin-catalog-backend-module-bc-data-catalogue
yarn add @bcgov/plugin-catalog-common-bc-data-catalogue
yarn add @bcgov/catalog-datasetUpdate:
packages/backend/src/index.ts
import { createBackend } from '@backstage/backend-defaults';
const backend = createBackend();
// ... other backend.add() calls ...
+ backend.add(import('@bcgov/plugin-catalog-backend-module-bc-data-catalogue'));
backend.start();Update app-config.yaml:
backend:
reading:
allow:
- host: catalogue.data.gov.bc.ca
scheme: httpscatalog:
providers:
bc-data-catalogue:
env: dev
schedule:
frequency: 10mThe dataset plugin requires two changes in the DevHub frontend.
Update:
packages/app/src/App.tsx
+ import { CatalogDatasetPage } from '@bcgov/catalog-dataset';
const routes = (
<FlatRoutes>
...
+ <Route path="/catalog-dataset" element={<CatalogDatasetPage />} />
</FlatRoutes>
);Update:
packages/app/src/components/catalog/EntityPage.tsx
+ import { CatalogDatasetPage } from '@bcgov/catalog-dataset';
<EntitySwitch>
<EntitySwitch.Case if={isKind('user')} children={userPage} />
<EntitySwitch.Case if={isKind('system')} children={systemPage} />
<EntitySwitch.Case if={isKind('domain')} children={domainPage} />
+ <EntitySwitch.Case if={isKind('dataset')} children={<CatalogDatasetPage />} />
<EntitySwitch.Case>{defaultEntityPage}</EntitySwitch.Case>
</EntitySwitch>After completing all steps:
- BC Data Catalogue datasets are ingested into Backstage
Datasetentities appear in the catalog- Selecting a dataset opens the custom dataset page
- Dataset-specific UI (schema, lineage, support, etc.) is rendered
@bcgov/plugin-catalog-backend-module-bc-data-catalogue@bcgov/plugin-catalog-common-bc-data-catalogue@bcgov/catalog-dataset
- Register backend module
- Allow API host
- Configure provider schedule
- Add route in
App.tsx - Add EntitySwitch case in
EntityPage.tsx
- Keep
GITHUB_TOKENout of source control - Additional hosts may need to be added to
backend.reading.allow - The dataset plugin relies on all three packages working together