Chapter 4. About Software Templates


Software Templates in Red Hat Developer Hub provide a streamlined way to create software components and publish them to different version control repositories such as Git. Platform engineers create and maintain Software Templates in Red Hat Developer Hub.

As a platform administrator, you can version Software Templates by using the existing custom actions catalog:scaffolded-from and catalog:template:version within the scaffolder backend module. By using these custom actions, you can track the scaffolder template version and the corresponding version of the entities created from it, which improves lifecycle management.

Prerequisites

  • You have administrator rights to Red Hat Developer Hub.

Procedure

To add versioning to a Software Template yaml file, complete the following steps:

  1. Modify the Software Template that you want to update.
  2. Complete one or both of the following tasks:

    • Include the backstage.io/template-version annotation in your template. When this annotation is present in your template, it is automatically used to annotate your catalog entity and a default version value is displayed.
    • Pass the backstage.io/template-version annotation as input to the action. This method takes precedence over the annotation in the template itself. It allows the user running the template to specify the version they wish to generate.
    # ...
    - id: version-templateRef
      name: Append the version of this template to the entityRef
      action: catalog:template:version
      input:
        annotations:
          backstage.io/template-version: ${{ parameters.version }}
    # ...
    Copy to Clipboard Toggle word wrap

Verification

  1. Create a catalog component using the updated Software Template. This step creates a new component in Backstage and optionally, pushes files to an external repository (For example, GitHub, GitLab).
  2. Check the component in the Catalog UI.

    1. On the Catalog page, locate the newly created catalog component.
    2. Verify that the backstage.io/template-version annotation is present in the entity. You can use INSPECT ENTITY and select YAML Raw or JSON Raw view to find the annotation in the component definition.
  3. Only if you have published the catalog component: Check the component file in the repository.

    1. If VIEW SOURCE is present in your UI: Click VIEW SOURCE to open the stored component file in the repository.
    2. Locate the file manually and verify that the backstage.io/template-version annotation is present.

As a platform engineer, you can enable notification alerts for template version updates using the @backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor module, an extension to the catalog-backend plugin. When enabled, this module automatically notifies component owners whenever the Software Template used to generate their components is updated to a new version.

This functionality uses the spec.scaffoldedFrom field in catalog entities. This field links Software Templates to the entities they have scaffolded. By tracking this relationship, the module helps teams stay informed and take advantage of the latest improvements or fixes.

The plugin-catalog-backend-module-scaffolder-relation-processor module is disabled by default.

Prerequisites

  • You have installed and configured the Backstage backend notification plugin @backstage/plugin-notifications-backend.
  • You have installed and configured the Backstage frontend plugin @backstage/plugin-notifications.

Procedure

  1. To enable the notifications, in your Red Hat Developer Hub app-config.yaml file, add the following codes:

    1. In the dynamicPlugins:frontend section:

      frontend:
        backstage.plugin-notifications:
          dynamicRoutes:
            - importName: NotificationPage
      	      menuItem:
      	        config:
      	          props:
                    titleCounterEnabled: true
      		          webNotificationsEnabled: false
      	        importName: NotificationsSidebarItem
      	        path: /notifications
      Copy to Clipboard Toggle word wrap
    2. In a new section:

      scaffolder:
        notifications:
          templateUpdate:
            enabled: true # Set to false to disable notifications
      Copy to Clipboard Toggle word wrap

      You can also customize the notification title and description as shown in the following code:

      scaffolder:
        notifications:
          templateUpdate:
            enabled: true
            message:
              title: 'Custom title for $ENTITY_DISPLAY_NAME'
              description: 'Custom description'
      Copy to Clipboard Toggle word wrap

      where:

      enabled
      Set to true to enable the notification. Default value is false.
      message:title
      Enter the notification title.
      message:description
      Enter the notification description.
Note

Both message:title and message:description support the template variable $ENTITY_DISPLAY_NAME. The system automatically substitutes this variable with the title (or the name, if the title is missing) of the entity scaffolded from the updated template.

Verification

  • In your Red Hat Developer Hub instance, on the left navigation menu, you are able to see Notifications, or, if configured, the custom title.
  • When you update the version number in the Software Template, you receive a notification.

Platform engineers use custom actions within the Software Template scaffolding process to establish and track the dependency link between a generated entity (Component or Resource) and its source template. This relationship is called scaffolding provenance.

Platform administrators use custom actions such as catalog:scaffolded-from and catalog:template:version in the scaffolder backend module to track the template version and the corresponding entity version, which simplifies lifecycle management.

As a platform engineer, you must modify the Software Template YAML definition to ensure the required provenance information is added during the scaffolding process.

Prerequisites

  • You have administrator rights to Red Hat Developer Hub.

Procedure

  1. Locate the Software Template object YAML file where you want to add the provenance information and add a step that uses the catalog:scaffolded-from action. This action links the resulting catalog entity back to the source template.
  2. Optional: To track the template version (for example, v1.0 versus v1.5), include the catalog:template:version action in the steps section. The following code block is an example to adding versioning action to the steps section:

    steps:
      - id: create-provenance-annotation
        name: Append the entityRef of this template to the entityRef
        action: catalog:scaffolded-from
      - id: create-version-annotation
        name: Create Template Version Annotation
        action: catalog:template:version
        input:
          templateVersion: ${{ parameters.version }}
      - ... other steps ...
    Copy to Clipboard Toggle word wrap

    where:

    steps:input:templateVersion

    Reads the version parameter

    Note

    The catalog:template:version action reads a version parameter defined in the template and applies it as an annotation to the resulting catalog entity.

  3. In your Red Hat Developer Hub app-config.yaml file, configure the catalog.locations section to point to the Software Template that you want to add. You might need to add Template to the global catalog.rules.allow list or add a granular rule to the location to allow for Software Templates ingestion, as shown in the following example:

    # ...
    catalog:
      locations:
        - type: url
          target: https://<repository_url>/example-template.yaml
          rules:
            - allow: [Template]
    # ...
    Copy to Clipboard Toggle word wrap

    where:

    catalog.locations.type
    Enter the url type if you are importing templates from a repository, such as GitHub or GitLab.
    catalog.locations.target
    Enter the URL for the template.
    catalog.locations.rules.allow
    Enter the Template rule to allow new Software Templates to be added to the catalog.

Verification

After creating a component with the updated template, verify the provenance annotations in the resulting Catalog Entity YAML.

  1. In the Red Hat Developer Hub navigation menu, go to Catalog and locate the newly created catalog component.
  2. To view the underlying data that links the entity to the template, select the INSPECT ENTITY option.
  3. To verify provenance annotations, complete the following steps:

    1. Select the YAML Raw or JSON Raw view and verify the presence of the data item for the scaffoldedFrom link.
    2. Optional: If versioning was included, verify the presence of the backstage.io/template-version annotation.

      Note

      If you publish the catalog component to an external repository (such as Git), the component file in that repository must also contain the backstage.io/template-version annotation.

4.3.2. Viewing Software Template dependencies

As a developer, you can track which entities were created from a specific Software Template. When a platform engineer configures provenance on a template, you can quickly identify the complete dependency and impact map of that template by viewing all linked components and resources in the Catalog.

Procedure

To view all components created from a specific template, complete the following steps:

  1. In the Red Hat Developer Hub navigation menu, click Catalog, use the filters to find and select the Software Template you wish to inspect.
  2. In the Software Template detail page, click the Dependencies tab. This view lists all catalog entities such as components, resources, and systems that reference this template, including any version information if configured.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat