Skip to content

feat(extensions): add source metadata to entities - #3939

Closed
christoph-jerolimov wants to merge 10 commits into
redhat-developer:mainfrom
hopehadfield:add-source-metadata
Closed

feat(extensions): add source metadata to entities#3939
christoph-jerolimov wants to merge 10 commits into
redhat-developer:mainfrom
hopehadfield:add-source-metadata

Conversation

@christoph-jerolimov

@christoph-jerolimov christoph-jerolimov commented Jul 23, 2026

Copy link
Copy Markdown
Member

This is a copy of #3711 where GitHub didn't updated the PR and now didn't let me reopen it because I force pushed the last 4 commits into your @hopehadfield branch. Normally this works fine. So here is a follow-up. You're work lgtm, Hope. -- I changes some configurations and moved the plugins yamls so that they are picked up now in the included Backstage app by the catalog-extensions-module.

From the origin PR:

Hey, I just made a Pull Request!

Resolves RHIDP-13665 / Epic RHIDP-13606

Problem

When RHDH is configured with multiple catalog index images (CATALOG_INDEX_IMAGE + EXTRA_CATALOG_INDEX_IMAGES), the install-dynamic-plugins init container extracts entities from each image into separate directories. However, once BaseEntityProvider ingests them into the Backstage catalog, all source information is lost with the current implementation.

Solution

Add an extensions.backstage.io/catalog-source annotation that is automatically derived from the on-disk directory layout and set on every entity emitted by BaseEntityProvider.

The derivation logic:

  • Entities from extra/<name>/catalog-entities/… get catalog-source: "<name>" (matching the name from EXTRA_CATALOG_INDEX_IMAGES)
  • All other entities get catalog-source: "primary"

Changes

File Change
extensions-common/src/annotations.ts Add CATALOG_SOURCE to ExtensionsAnnotation enum
catalog-backend-module-extensions/src/providers/BaseEntityProvider.ts Add deriveCatalogSource() static method; update addProviderAnnotations() to set the annotation using the entity's file path
catalog-backend-module-extensions/src/providers/BaseEntityProvider.test.ts 12 new tests: source derivation (7) + annotation integration (5)
docs/catalog/plugins.md Document the new annotation
catalog-backend-module-extensions/README.md Document multi-source catalog layout and source derivation

How to test

Unit tests:

cd workspaces/extensions/plugins/catalog-backend-module-extensions
yarn backstage-cli package test --watchAll=false

Local dev (manual):

  1. Create a multi-source directory:
    test-extensions/
      catalog-entities/plugins/primary-plugin.yaml
      extra/community/catalog-entities/plugins/community-plugin.yaml
    
  2. Set extensions.directory in app-config.yaml to point at it
  3. Start the backend and inspect the relevant plugin entities

Design decisions

  • "primary" as default. Vendor-neutral. The UI/config layer can map it to a display label as desired.
  • Freeform string values. Not an enforced enum — operators choose source names via EXTRA_CATALOG_INDEX_IMAGES (community=quay.io/...).
  • Applies to all entity kinds. Implemented in BaseEntityProvider, so Plugins, Packages, and Collections all get the annotation.
  • No change to duplicate handling. Existing first-wins dedup policy is unchanged; source annotations don't affect it.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

hopehadfield and others added 10 commits July 23, 2026 10:32
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
…ing extensions

Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
…w catalog-source annotation gots automatically added

Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
@christoph-jerolimov christoph-jerolimov changed the title Add source metadata feat(extensions): add source metadata to entities Jul 23, 2026
@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Jul 23, 2026

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again manually by commenting /agentic_review on this PR.

Grey Divider

Qodo Logo

@rhdh-gh-app

rhdh-gh-app Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-catalog-backend-module-extensions workspaces/extensions/plugins/catalog-backend-module-extensions minor v0.19.0
@red-hat-developer-hub/backstage-plugin-extensions-common workspaces/extensions/plugins/extensions-common minor v0.19.0

@rhdh-qodo-merge

Copy link
Copy Markdown

Preparing PR labels...

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 57.35%. Comparing base (70f61da) to head (c165b09).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3939   +/-   ##
=======================================
  Coverage   57.35%   57.35%           
=======================================
  Files        2384     2384           
  Lines       95608    95617    +9     
  Branches    26699    26704    +5     
=======================================
+ Hits        54832    54841    +9     
- Misses      39238    39239    +1     
+ Partials     1538     1537    -1     
Flag Coverage Δ *Carryforward flag
adoption-insights 84.54% <ø> (ø) Carriedforward from 70f61da
ai-integrations 69.26% <ø> (ø) Carriedforward from 70f61da
app-defaults 69.79% <ø> (ø) Carriedforward from 70f61da
augment 46.67% <ø> (ø) Carriedforward from 70f61da
boost 75.89% <ø> (ø) Carriedforward from 70f61da
bulk-import 72.61% <ø> (ø) Carriedforward from 70f61da
cost-management 13.55% <ø> (ø) Carriedforward from 70f61da
dcm 60.72% <ø> (ø) Carriedforward from 70f61da
extensions 56.38% <92.85%> (+0.10%) ⬆️
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 70f61da
global-header 62.19% <ø> (ø) Carriedforward from 70f61da
homepage 47.58% <ø> (ø) Carriedforward from 70f61da
install-dynamic-plugins 56.77% <ø> (ø) Carriedforward from 70f61da
intelligent-assistant 74.05% <ø> (ø) Carriedforward from 70f61da
konflux 91.98% <ø> (ø) Carriedforward from 70f61da
lightspeed 69.02% <ø> (ø) Carriedforward from 70f61da
mcp-integrations 83.40% <ø> (ø) Carriedforward from 70f61da
orchestrator 62.67% <ø> (ø) Carriedforward from 70f61da
quickstart 65.18% <ø> (ø) Carriedforward from 70f61da
sandbox 79.56% <ø> (ø) Carriedforward from 70f61da
scorecard 82.66% <ø> (ø) Carriedforward from 70f61da
theme 83.85% <ø> (ø) Carriedforward from 70f61da
translations 5.12% <ø> (ø) Carriedforward from 70f61da
x2a 79.31% <ø> (ø) Carriedforward from 70f61da

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70f61da...c165b09. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

Copy link
Copy Markdown

@karthikjeeyar karthikjeeyar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants