Added documentation for creation of a backstage template

This commit is contained in:
evdo 2025-01-15 15:07:45 +01:00
parent 304fbdcdcb
commit c9f55115cf

View file

@ -0,0 +1,80 @@
## Adding a New Backstage Template to EDPBuilder
### 1. Clone the Stacks Repository
Clone the stacks repository containing the stacks for edpuilder<br>
`git clone https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/stacks.git`
### 2. Create a Directory for Your Template
Navigate to the directory:<br>
`stacks/template/stacks/ref-implementation/backstage-templates/entities`
Create a new directory for your template within this path.
### 3. Add a `template.yaml` File
In the newly created template directory, create a file named `template.yaml`. This file will define the steps of your template pipeline.
Each step in the pipeline must include:
- **Name**: A descriptive name that will be displayed in the Backstage interface.
- **Action**: An action from the list of available Backstage actions.
- **Parameters**: Input parameters required by the action.
You can view the list of available actions in the Backstage interface at the following URL:
`{address_of_your_backstage}/create/actions`
#### Example of `template.yaml`:
```yaml
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: my-new-template
title: My New Template
description: A description of the template.
spec:
owner: team@example.com
steps:
- id: fetch
name: Fetch Repository
action: fetch:plain
input:
url: https://github.com/example/repo
- id: log
name: Log Step
action: debug:log
input:
message: "Processing template pipeline"
```
### 4. Add a skeleton Directory
Within your template directory, create a subdirectory named skeleton. This is where you can place the files for your template.
### 5. Update the `catalog-info.yaml` File
To make your new template visible in Backstage, update the `catalog-info.yaml` file located in:<br>
`stacks/template/stacks/ref-implementation/backstage-templates`
Add the path to the `template.yaml` file of your new template under the `targets` section.
#### Example `catalog-info.yaml`:
```yaml
apiVersion: backstage.io/v1alpha1
kind: Location
metadata:
name: basic-example-templates
description: A collection of example templates
spec:
targets:
- ./basic/template.yaml
- ./argo-workflows/template.yaml
- ./app-with-bucket/template.yaml
- ./demo-go-hello-world/template.yaml
- ./spring-petclinic/template.yaml
- ./my-new-template/template.yaml
---
apiVersion: backstage.io/v1alpha1
kind: Location
metadata:
name: basic-organization
description: Basic organization data
spec:
targets:
- ./organization/guests.yaml
```