This example demonstrates building the TODO plugin from the Backstage Community Plugins repository with a custom scalprum-config.json configuration.
- TODO Example Configuration
This example builds both the frontend and backend TODO plugins from the Backstage Community Plugins repository. It includes a custom Scalprum configuration file to control the dynamic plugin export behavior.
example-config-todo/
├── plugins/
│ └── todo/
│ └── scalprum-config.json # Custom Scalprum configuration to overlay
├── plugins-list.yaml # List of plugins to build
└── source.json # Source repository configurationsource.json: Specifies the Backstage Community Plugins repository and git reference to clone from. Therepo-reffield is optional; when omitted, the repository's default branch is used. Theworkspace-pathfield can also be set here instead of using--workspace-path.plugins-list.yaml: Lists the path to the TODO frontend and backend plugins to build with respect to the workspace pathplugins/todo/scalprum-config.json: Custom Scalprum configuration that will be overlaid on top of the plugin source directory
From the repository root, run:
podman run --rm -it \
--device /dev/fuse \
-v ./examples/example-config-todo:/config:z \
-v ./outputs:/outputs:z \
quay.io/rhdh-community/dynamic-plugins-factory:latest \When --source-ref is omitted, the repository's default branch is used automatically.
From the repository root, run:
python -m src.rhdh_dynamic_plugin_factory \
--config-dir ./examples/example-config-todo \
--repo-path ./source \
--output-dir ./outputsOr using CLI args instead of source.json:
python -m src.rhdh_dynamic_plugin_factory \
--source-repo https://github.com/backstage/community-plugins \
--source-ref main \
--config-dir ./examples/example-config-todo \
--repo-path ./source \
--workspace-path workspaces/todo \
--output-dir ./outputsThis will do the following:
- The factory clones the Backstage Community Plugins repository to
./source - The custom
scalprum-config.jsonis overlaid on top of the plugin source directory - Dependencies are installed in the TODO workspace
- Both frontend and backend plugins are exported and packaged using the RHDH CLI with the arguments defined in
./config/plugins-list.yamlwhich in this case is no additional arguments - Plugin tarballs and integrity files are created in
./outputs
After successful execution, you'll find these files in ./outputs:
outputs/
├── backstage-community-plugin-todo-0.12.0.tgz
├── backstage-community-plugin-todo-0.12.0.tgz.integrity
├── backstage-community-plugin-todo-backend-0.13.0.tgz
└── backstage-community-plugin-todo-backend-0.13.0.tgz.integrityNote: Version numbers may vary depending on the plugin versions in the source repository.
If you want to publish the package, you will need to add a --push-image argument and provide the following environmental variables in the /config/.env file:
REGISTRY_URL="quay.io"
REGISTRY_USERNAME="your-username"
REGISTRY_PASSWORD="your-password"
REGISTRY_NAMESPACE="your-namespace"
REGISTRY_INSECURE="false"You can verify the plugins work correctly by installing them in an RHDH instance. Here's how to test with RHDH Local:
- RHDH Local repository cloned
- Podman installed
- Plugins built and published to a container registry
Create a dynamic-plugins.override.yaml file in the RHDH Local config directory:
includes:
- dynamic-plugins.default.yaml
plugins:
- package: oci://quay.io/{REGISTRY_NAMESPACE}/backstage-community-plugin-todo:0.12.0!backstage-community-plugin-todo
disabled: false
pluginConfig:
dynamicPlugins:
frontend:
backstage-community.plugin-todo:
mountPoints:
- mountPoint: entity.page.todo/cards
importName: EntityTodoContent
entityTabs:
- path: /todo
title: Todo
mountPoint: entity.page.todo
- package: oci://quay.io/{REGISTRY_NAMESPACE}/backstage-community-plugin-todo-backend:0.13.0!backstage-community-plugin-todo-backend
disabled: falseReplace {REGISTRY_NAMESPACE} with your registry namespace.
Note: If you pushed to a private repository, make it public or configure Podman credentials.
Create or edit config/app-config/app-config.local.yaml to import the Backstage repository:
catalog:
locations:
- type: url
target: https://github.com/backstage/backstage/blob/master/catalog-info.yaml
rules:
- allow: [Component]podman compose up -d- Open your browser to http://localhost:7007
- Navigate to the Backstage component located at http://localhost:7007/catalog/default/component/backstage
- Click on the Todo tab
- You should see a table containing all
TODOcomments from the Backstage source code
podman compose down --volumes- Try the GitLab example to learn about overlays
- Try the AWS ECS example to learn about patches and embed packages
- Read the main README for more configuration options