Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add catalog-info yamls #1885

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

jerolimov
Copy link
Member

@jerolimov jerolimov commented Jul 11, 2024

A set of catalog-info.yaml files that adds overall 77 components for all plugins, frontend-plugins, backend-plugins, and shared libraries.

Component types

One catalog-info yaml for each plugin and one additional plugin for each "meta plugin", "plugin pack" or "plugin group"..

The types of the components are aligned with the upstream types:

  1. type: backstage-backend components are "meta plugin" that doesn't contain code
    • their catalog component name has no suffix, for example janus-idp-rbac
  2. Additional types are available for all kinds of plugins, modules, or libraries. See below.
    • frontend plugins use the component name suffix -frontend, like janus-idp-rbac-frontend
backstage (master)  find plugins packages -name catalog-info.yaml | xargs grep 'type: ' | sed 's/.*type: //g' | sort | uniq -c
      2 backstage-backend
     15 backstage-backend-plugin
     64 backstage-backend-plugin-module
      6 backstage-cli
     18 backstage-common-library
      3 backstage-frontend
     20 backstage-frontend-plugin
      2 backstage-frontend-plugin-module
     28 backstage-node-library
     24 backstage-web-library
      4 service
      1 website
community-plugins (main)  find -name catalog-info.yaml | xargs grep 'type: ' | sed 's/.*type: //g' | sort | uniq -c
     22 backstage-backend-plugin
      2 backstage-backend-plugin-module
     11 backstage-common-library
     59 backstage-frontend-plugin
      4 backstage-frontend-plugin-module
      2 backstage-node-library
      2 backstage-web-library
      1 service
     61 website
backstage-plugins (update-catalog-infos)  find plugins packages -name catalog-info.yaml | xargs grep '^  type: ' | sed 's/.*type: //g' | sort | uniq -c
     10 backstage-backend-plugin
      1 backstage-backend-plugin-module
      1 backstage-cli
      7 backstage-common-library
     19 backstage-frontend-plugin
      8 backstage-frontend-plugin-module
      2 backstage-node-library
     30 backstage-plugin
      1 backstage-web-library

Testing this PR

Checkout this branch and link the root catalog-info.yaml and catalog-info-teams.yaml:

catalog:
  locations:
    - type: file
      target: /home/christoph/git/janus-idp/backstage-plugins/catalog-info-teams.yaml
      rules:
        - allow: [Group]
    - type: file
      target: /home/christoph/git/janus-idp/backstage-plugins/catalog-info.yaml

Or link the branch on GitHub:

catalog:
  locations:
    - type: url
      target: /https://github.com/jerolimov/janus-backstage-plugins/blob/update-catalog-infos/catalog-info-teams.yaml
      rules:
        - allow: [Group]
    - type: url
      target: https://github.com/jerolimov/janus-backstage-plugins/blob/update-catalog-infos/catalog-info.yaml

Screenshots

Catalog types:

image

Backstage plugins:

image

Frontend plugins:

image

etc.

RBAC as example:

image

Copy link

openshift-ci bot commented Jul 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign invinciblejai for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@durandom
Copy link
Member

nice, do you also want to add the script that generated the basis for the catalog yaml files?

@jerolimov jerolimov self-assigned this Aug 12, 2024
@jerolimov jerolimov force-pushed the update-catalog-infos branch 3 times, most recently from 222a46b to fff288a Compare August 12, 2024 21:49
@jerolimov
Copy link
Member Author

nice, do you also want to add the script that generated the basis for the catalog yaml files?

@durandom I used this script to create the initial files but touched every file after that manually. So it's not good enough for a general approach:

#!/bin/bash

set -e

for pluginFolder in plugins/*; do
    plugin=$(basename $pluginFolder)
    # echo "$plugin ..."
    cd $pluginFolder

    if [ ! -f package.json ]; then
        echo "package.json not found!!!!!"
        continue
    fi

    # npm show name
    name=$(npm view . name | sed 's/^.*://')
    desc=$(npm view . description | sed 's/^.*://')

    # echo NAME:
    # echo $name
    # echo DESC:
    # echo $desc

    type=""
    # pluginFolder ends with backend
    if [[ $pluginFolder == *"backend"* || $pluginFolder == *"node"* ]]; then
        echo "BACKEND  $plugin"
        type="backstage-backend-plugin"
    elif [[ $pluginFolder == *"common"* ]]; then
        echo "COMMON   $plugin"
        type="backstage-common-library"
    elif [[ $pluginFolder != *"backend"* ]]; then
        echo "FRONTEND $plugin"
        type="backstage-frontend-plugin"
    fi

    # write a yaml file into catalog-info.yaml
    cat <<EOF > catalog-info.yaml
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: janus-idp-$plugin
  title: $name
  description: $description
  annotations:
    backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/$plugin
    backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/$plugin/catalog-info.yaml
    backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/$plugin/catalog-info.yaml
    github.com/project-slug: janus-idp/backstage-plugins
    #github.com/team-slug: janus-idp/maintainers
    sonarqube.org/project-key: janus-idp_backstage-plugins
  links:
    - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/$plugin
      title: GitHub Source
      icon: source
      type: source
spec:
  type: $type
  lifecycle: production
  owner: rhdh-team
  system: rhdh
EOF

    cd ../..
done

@jerolimov
Copy link
Member Author

/cc @durandom @debsmita1 @divyanshiGupta @karthikjeeyar @schultzp2020 @kadel

Can you please take a look if we can start with this set of catalog-info.yamls? Should we ask anyone else?

@durandom
Copy link
Member

I think it's a great start.

/lgtm

Signed-off-by: Christoph Jerolimov <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm label Aug 13, 2024
Copy link

sonarcloud bot commented Aug 13, 2024

@jerolimov
Copy link
Member Author

Just rebased after yarn.lock fix was merged with #2046

@durandom
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 13, 2024
@durandom
Copy link
Member

/approve

@openshift-merge-bot openshift-merge-bot bot merged commit 0fa89c7 into janus-idp:main Aug 13, 2024
10 checks passed
@jerolimov jerolimov deleted the update-catalog-infos branch August 13, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants