|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | + |
| 3 | +[id="proc-configuring-provenance-and-software-template-versioning_{context}"] |
| 4 | += Configuring provenance and Software Template versioning {product} |
| 5 | + |
| 6 | +As a platform engineer, you must modify the Software Template YAML definition to ensure the required provenance information is added during the scaffolding process. |
| 7 | + |
| 8 | +.Prerequisites |
| 9 | + |
| 10 | +* You have administrator rights to {product}. |
| 11 | + |
| 12 | +.Procedure |
| 13 | + |
| 14 | +. 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. |
| 15 | +. 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: |
| 16 | ++ |
| 17 | +[source,yaml] |
| 18 | +---- |
| 19 | +steps: |
| 20 | + - id: create-provenance-annotation |
| 21 | + name: Append the entityRef of this template to the entityRef |
| 22 | + action: catalog:scaffolded-from |
| 23 | + - id: create-version-annotation |
| 24 | + name: Create Template Version Annotation |
| 25 | + action: catalog:template:version |
| 26 | + input: |
| 27 | + templateVersion: ${{ parameters.version }} |
| 28 | + - ... other steps ... |
| 29 | +---- |
| 30 | ++ |
| 31 | +where: |
| 32 | + |
| 33 | +`steps:input:templateVersion`:: Reads the version parameter |
| 34 | ++ |
| 35 | +[NOTE] |
| 36 | +==== |
| 37 | +The `catalog:template:version` action reads a version parameter defined in the template and applies it as an annotation to the resulting catalog entity. |
| 38 | +==== |
| 39 | + |
| 40 | +. In your {product} `{my-app-config-file}` 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: |
| 41 | ++ |
| 42 | +[source,yaml] |
| 43 | +---- |
| 44 | +# ... |
| 45 | +catalog: |
| 46 | + locations: |
| 47 | + - type: url |
| 48 | + target: https://<repository_url>/example-template.yaml |
| 49 | + rules: |
| 50 | + - allow: [Template] |
| 51 | +# ... |
| 52 | +---- |
| 53 | ++ |
| 54 | +where: |
| 55 | + |
| 56 | +`catalog.locations.type`:: Enter the `url` type if you are importing templates from a repository, such as GitHub or GitLab. |
| 57 | +`catalog.locations.target`:: Enter the URL for the template. |
| 58 | +`catalog.locations.rules.allow`:: Enter the `Template` rule to allow new Software Templates to be added to the catalog. |
| 59 | + |
| 60 | +.Verification |
| 61 | + |
| 62 | +After creating a component with the updated template, verify the provenance annotations in the resulting Catalog Entity YAML. |
| 63 | + |
| 64 | +. In the {product} navigation menu, go to *Catalog* and locate the newly created catalog component. |
| 65 | +. To view the underlying data that links the entity to the template, select the **INSPECT ENTITY** option. |
| 66 | +. To verify provenance annotations, complete the following steps: |
| 67 | +.. Select the *YAML Raw* or *JSON Raw* view and verify the presence of the data item for the `scaffoldedFrom` link. |
| 68 | +.. Optional: If versioning was included, verify the presence of the `backstage.io/template-version` annotation. |
| 69 | ++ |
| 70 | +[NOTE] |
| 71 | +==== |
| 72 | +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. |
| 73 | +==== |
0 commit comments