backstage-plugins icon indicating copy to clipboard operation
backstage-plugins copied to clipboard

feat: add custom processor module to add ScaffoldedFrom relation

Open Zaperex opened this issue 1 year ago • 10 comments

Description

Adds a custom catalog processor that creates relations between catalog entities and the scaffolder templates that created them based on the spec.scaffoldedFrom field in the catalog-info.yaml of the catalog entities.

image

What issue(s) does this fix?

Fixes: RHIDP-2156

How to test changes / Special notes to the reviewer

  1. Install the module using the instructions in the README.md
  2. Ingest an entity with a spec.scaffoldedFrom field that matches the entityRef of a template entity in the catalog (ex: template:default/test-template). You can potentially use the following example template: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml
  3. Observe the relation graph of the entity in the catalog (or view the raw YAML/JSON of the entity and find the scaffoldedFrom relation in the relations array)

Zaperex avatar Apr 30 '24 17:04 Zaperex

/retest failing

Zaperex avatar Apr 30 '24 20:04 Zaperex

@Zaperex: No presubmit jobs available for janus-idp/backstage-plugins@main

In response to this:

/retest failing

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-ci[bot] avatar Apr 30 '24 20:04 openshift-ci[bot]

/retest

Zaperex avatar Apr 30 '24 20:04 Zaperex

/retest

Zaperex avatar Apr 30 '24 20:04 Zaperex

Used in conjunction with https://github.com/janus-idp/backstage-plugins/pull/1567

Zaperex avatar May 09 '24 15:05 Zaperex

/retest

Zaperex avatar May 17 '24 15:05 Zaperex

Hmm that's weird, the template should have the reverse relation (scaffolderOf) in the dependency graph since it should appear in the relations field of it's Raw YAML. In the following, I tested with backstage-showcase when I dynamically installed it (after modifying the catalog such that the templates has a dependency graph). In my case, the ownedBy link did not appear in the dependency graph since the corresponding entity did not exist in the catalog. Could that have been the case for you?

image image

Zaperex avatar May 21 '24 20:05 Zaperex

Added usage docs with examples of expected outputs. You can try using this software template that contains the custom action that automatically applies this spec.scaffoldedFrom field to catalog entities: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml

Zaperex avatar May 21 '24 21:05 Zaperex

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: PatAKnight

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar May 22 '24 12:05 openshift-ci[bot]

It should work if you manually add it though (as long as the referenced template exists)? That's how I initially tested it before having the action.

Zaperex avatar May 22 '24 12:05 Zaperex