Catalog Info Cleaner

Action ID: terasky:catalog-info-cleaner
NPM Package:

@terasky/backstage-plugin-scaffolder-backend-module-terasky-utils

Description

Templates a claim manifest based on input parameters

Input Schema

PropertyTypeDescriptionRequired
entityobject-

Output Schema

PropertyTypeDescriptionRequired
filePathstring-
manifeststring-

Usage Examples

Generate a claim manifest for a new service and publish to GitHub

Use this to generate a claim manifest for a new Component entity, then publish the workspace to a new GitHub repository. The example lays down files with fetch:template, creates the manifest with terasky:catalog-info-cleaner, logs the outputs with debug:log, and publishes with publish:github.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}
        system: payments
        description: ${{ parameters.description }}

  - id: claim-manifest
    action: terasky:catalog-info-cleaner
    input:
      entity:
        apiVersion: backstage.io/v1alpha1
        kind: Component
        metadata:
          name: ${{ parameters.name }}
          namespace: app
          description: ${{ parameters.description }}
          tags:
            - service
            - payments
          annotations:
            github.com/project-slug: my-org/${{ parameters.repoName }}
        spec:
          type: service
          lifecycle: production
          owner: ${{ parameters.owner }}
          system: payments

  - id: log-claim
    action: debug:log
    input:
      message: >
        Generated claim manifest at ${{ steps.claim-manifest.output.filePath }}

  - id: publish
    action: publish:github
    input:
      repoUrl: github.com?owner=my-org&repo=${{ parameters.repoName }}

Create a claim manifest for a shared database resource in a monorepo

Use this when adding an internal Resource entity to a platform monorepo. It scaffolds files into a subdirectory with fetch:template, generates a claim manifest for the Resource, logs the output with debug:log, and publishes changes with publish:github.

Copy
steps:
  - id: fetch-infra-skeleton
    action: fetch:template
    input:
      url: ./infra-resource
      targetPath: infra/resources/${{ parameters.resourceName }}
      values:
        resourceName: ${{ parameters.resourceName }}
        owner: platform-team
        system: shared-platform
        description: PostgreSQL database for the Orders domain

  - id: resource-claim
    action: terasky:catalog-info-cleaner
    input:
      entity:
        apiVersion: backstage.io/v1alpha1
        kind: Resource
        metadata:
          name: ${{ parameters.resourceName }}
          namespace: prod
          description: Provisioned PostgreSQL instance for Orders
          labels:
            env: prod
            tier: data
          annotations:
            kubernetes.io/namespace: prod-data
        spec:
          type: database
          owner: platform-team
          system: shared-platform
        relations:
          - type: dependencyOf
            targetRef: component:default/orders-api

  - id: log-resource-claim
    action: debug:log
    input:
      message: |
        Claim manifest path: ${{ steps.resource-claim.output.filePath }}

  - id: publish-monorepo
    action: publish:github
    input:
      repoUrl: github.com?owner=my-org&repo=platform-infra