이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 4. Configuring templates


Configure templates to create software components, and publish these components to different locations, such as the Red Hat Developer Hub software catalog, or Git repositories.

A template is a form composed of different UI fields that is defined in a YAML file. Templates include actions, which are steps that are executed in sequential order and can be executed conditionally.

4.1. Creating a Software Template by using the Template Editor

Use the Red Hat Developer Hub Template Editor to create a Software Template.

Alternately, you can use the Template Editor to do any of the following actions:

  • File > Open template directory
  • File > Create template directory
  • File > Close template editor
  • Use the Custom Fields Explorer button to test custom fields in your templates.yaml file
  • View Installed Actions Documentation

Procedure

To create a Software Template by using the Template Editor templates, complete the following steps:

  1. In your Red Hat Developer Hub navigation menu, click Create…​.
  2. Click the overview menu and select Manage Templates.

    Template Editor
    Note
    • The following options on the Managed Templates page do not create a software component in your Red Hat Developer Hub instance:

      • Template Form Playground: Use to create and test the templates.yaml file
      • Custom Field Explorer: Use to test custom fields
  3. On the Managed Templates page, select any of the following options:

    • Load Template Directory: Use to load an existing templates.yaml file

      • In your local file manager, navigate to the folder where your templates.yaml file is stored and click Select.
    • Create New Template: Use to create a templates.yaml file

      1. In your local file manager, navigate to the folder where you want the Template Editor to create a templates.yaml file and click Select.
      2. On the Template Editor page, select the templates.yaml file.
      3. (Optional) You can preview and test your template specifications.

        1. On the Fill in some steps tab, enter text into the required fields and click Next.
        2. On the Repository Location tab, enter text into the required fields and click Review.
        3. Modify the YAML definition for the parameters of your template. For more information about these parameters, see Section 4.2, “Creating a Software Template as a YAML file”.
        4. Review the information for accuracy, then click Create.

Verification

  1. Click the Catalog tab in the navigation panel.
  2. In the Kind drop-down menu, select Template.
  3. Confirm that your Software Template is shown in the list of existing templates.

4.2. Creating a Software Template as a YAML file

You can create a Software Template by defining a Template object as a YAML file.

The Template object describes the template and its metadata. It also contains required input variables and a list of actions that are executed by the scaffolding service.

Template object example

apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: template-name 
1

  title: Example template 
2

  description: An example template for v1beta3 scaffolder. 
3

spec:
  owner: backstage/techdocs-core 
4

  type: service 
5

  parameters: 
6

    - title: Fill in some steps
      required:
        - name
      properties:
        name:
          title: Name
          type: string
          description: Unique name of the component
        owner:
          title: Owner
          type: string
          description: Owner of the component
    - title: Choose a location
      required:
        - repoUrl
      properties:
        repoUrl:
          title: Repository Location
          type: string
  steps: 
7

    - id: fetch-base
      name: Fetch Base
      action: fetch:template
      # ...
  output: 
8

    links:
      - title: Repository 
9

        url: ${{ steps['publish'].output.remoteUrl }}
      - title: Open in catalog 
10

        icon: catalog
        entityRef: ${{ steps['register'].output.entityRef }}
# ...
Copy to Clipboard

1
Specify a name for the Software Template.
2
Specify a title for the Software Template. This is the title that is visible on the Software Template tile in the Create…​ view.
3
Specify a description for the Software Template. This is the description that is visible on the Software Template tile in the Create…​ view.
4
Specify the ownership of the Software Template. The owner field provides information about who is responsible for maintaining or overseeing the Software Template within the system or organization. In the provided example, the owner field is set to backstage/techdocs-core. This means that this Software Template belongs to the techdocs-core project in the backstage namespace.
5
Specify the component type. Any string value is accepted for this required field, but your organization should establish a proper taxonomy for these. Red Hat Developer Hub instances may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Red Hat Developer Hub interface that is specific to just websites.

The following values are common for this field:

service
A backend service, typically exposing an API.
website
A website.
library
A software library, such as an npm module or a Java library.
6
Use the parameters section to specify parameters for user input that are shown in a form view when a user creates a component by using the Software Template in the Red Hat Developer Hub console. Each parameters subsection, defined by a title and properties, creates a new form page with that definition.
7
Use the steps section to specify steps that are executed in the backend. These steps must be defined by using a unique step ID, a name, and an action. You can view actions that are available on your Red Hat Developer Hub instance by visiting the URL https://<rhdh_url>/create/actions.
8
Use the output section to specify the structure of output data that is created when the Software Template is used. The output section, particularly the links subsection, provides valuable references and URLs that users can utilize to access and interact with components that are created from the Software Template.
9
Provides a reference or URL to the repository associated with the generated component.
10
Provides a reference or URL that allows users to open the generated component in a catalog or directory where various components are listed.

4.3. Importing an existing Software Template to Red Hat Developer Hub

You can add an existing Software Template to your Red Hat Developer Hub instance by using the Catalog Processor.

Prerequisites

  • You have created a directory or repository that contains at least one Software Template YAML file.
  • If you want to use a Software Template that is stored in a repository such as GitHub or GitLab, you must configure a Red Hat Developer Hub integration for your provider.

Procedure

  • In the app-config.yaml configuration file, modify the catalog.rules section to include a rule for templates, and configure the catalog.locations section to point to the Software Template that you want to add, as shown in the following example:

    # ...
    catalog:
      rules:
        - allow: [Template] 
    1
    
      locations:
        - type: url 
    2
    
          target: https://<repository_url>/example-template.yaml 
    3
    
    # ...
    Copy to Clipboard
    1
    To allow new Software Templates to be added to the catalog, you must add a Template rule.
    2
    If you are importing templates from a repository, such as GitHub or GitLab, use the url type.
    3
    Specify the URL for the Software Template.

Verification

  1. Click the Catalog tab in the navigation panel.
  2. In the Kind drop-down menu, select Template.
  3. Confirm that your Software Template is shown in the list of existing Software Templates.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat