1.3.2 • Published 10 months ago

@janus-idp/backstage-plugin-catalog-backend-module-scaffolder-relation-processor v1.3.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

❗DEPRECATED❗

This package has been deprecated.

Please use the @backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor package instead.

Catalog Backend Module for Scaffolder Relation Catalog Processor

This is an extension module to the catalog-backend plugin, providing an additional catalog entity processor that adds a new relation that depends on the spec.scaffoldedFrom field to link scaffolder templates and the catalog entities they generated.

Getting Started

  1. Install the scaffolder relation catalog processor module using the following command:

    yarn workspace backend add @janus-idp/backstage-plugin-catalog-backend-module-scaffolder-relation-processor

Installing on the new backend system

To install this module into the new backend system, add the following into the packages/backend/src/index.ts file:

const backend = createBackend();

// highlight-add-start
backend.add(
  import(
    '@janus-idp/backstage-plugin-catalog-backend-module-scaffolder-relation-processor/alpha'
  ),
);
// highlight-add-end

backend.start();

Installing on the legacy backend system

To install this module into the legacy backend system, add the following to the packages/backend/src/plugins/catalog.ts file:

// highlight-add-start
import { ScaffolderRelationEntityProcessor } from '@janus-idp/backstage-plugin-catalog-backend-module-scaffolder-relation-processor';

// highlight-add-end

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  const builder = await CatalogBuilder.create(env);

  /* ... other processors and/or providers ... */
  // highlight-add-start
  builder.addProcessor(new ScaffolderRelationEntityProcessor());
  // highlight-add-end

  const { processingEngine, router } = await builder.build();
  await processingEngine.start();

  return router;
}

Usage

Catalog entities containing the spec.scaffoldedFrom field will have a relation link be formed between it and the template corresponding to the entity ref in the spec.scaffoldedFrom field.

This link can be viewed in the relations field of the Raw YAML view of a catalog entity when inspecting an entity. In the entity with the spec.scaffoldedFrom field, the relation type is scaffoldedFrom with a target pointing to the value of the spec.scaffoldedFrom field. Conversely, for the target template, it will have a relation type of ScaffolderOf with a target pointing to the entity with the spec.scaffoldedFrom field.

These relations should also appear on the EntityCatalogGraphView component from the @backstage/plugin-catalog-graph package (only if the entity corresponding to the entity ref exists in the catalog).

Example graph view

scaffoldedFrom Relation Graph View scaffolderOf Relation Graph View

Example Raw YAML view

scaffoldedFrom Relation YAML View scaffoldedOf Relation YAML View