#Location to Component stitching problem

1 messages · Page 1 of 1 (latest)

tough condor
#

Hello, I'm looking for help with the following case:

The problem: digested Location doesn’t stitched to Component. Backstage log shows only warning regarding missed annotation “http://backstage.io/managed-by-location"
Context:

  • I’m using GithubOrgEntityProvider and GithubEntityProvider fo Catalog pluging only
  • Backstage version 1.15.0
  • Catalog config is following:
catalog:
  rules:
    - allow: [Component, API, Group, User, Template, Location, Domain, System, Resource]
  providers:
    github:
      simpleRepo:
        organization: 'noname'
        catalogPath: '/catalog-info.yaml'
        filters:
          repository: '^(software-catalog-test|software-catalog-monorepo-test)$'
      monoRepo:
        organization: 'noname'
        catalogPath: '/packages/**/catalog-info.yaml'
        filters:
          repository: '^(software-catalog-test|software-catalog-monorepo-test)$'
  • example catalog-info.yaml is following:
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: test1
  description: "Lorem ipsum"
  annotations: [
    {
      "backstage.io/managed-by-location": "url:https:/github.com/noname/software-catalog-test/blob/main/catalog-info.yaml"
    }
  ]
spec:
  type: other
  lifecycle: production
  domain: unknown
  system: unknown
  owner: architecture
relations: []
  • as a result I have following Location never stitched to Component
{
  "metadata": {
    "namespace": "default",
    "annotations": {
      "backstage.io/managed-by-location": "xx",
      "backstage.io/managed-by-origin-location": "xxx",
      "backstage.io/view-url": "xx",
      "backstage.io/edit-url": "xx",
      "backstage.io/source-location": "xx"
    },
    "name": "generated-xxx",
    "uid": "xx",
    "etag": "xx"
  },
  "apiVersion": "backstage.io/v1alpha1",
  "kind": "Location",
  "spec": {
    "type": "url",
    "target": "xx",
    "presence": "optional"
  },
  "relations": [
    
  ]
}
cunning hare
#

first thing i note: you are not meant to put in backstage.io/managed-by-location or backstage.io/managed-by-origin-location annotations yourself; those are generated by the catalog

#

what does the spec.target of the generated Location look like?

tough condor
#

it's properly pointing to the source file

cunning hare
#

and not a ton of other stuff in the catalog either?

#

do you have access to the backend logs to see if there's something there that might indicate problems

tough condor
#

I'm testing locally and have only 5 locations for mentioned config. Users and Group was parsed respectfully to github.

#

Logs also doesn't provide much insights

#

and BTW I have the following catalog.ts

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  const builder = await CatalogBuilder.create(env);
  builder.setProcessingIntervalSeconds(300);
  builder.addProcessor(new ScaffolderEntitiesProcessor());
  builder.addEntityProvider(
    GithubOrgEntityProvider.fromConfig(env.config, {
      id: 'github-org-provider',
      orgUrl: 'https://github.com/noname',
      logger: env.logger,
      schedule: env.scheduler.createScheduledTaskRunner({
        frequency: { minutes: 30 },
        timeout: { minutes: 35 },
      })
    }),
  );
  builder.addEntityProvider(
    GithubEntityProvider.fromConfig(env.config, {
      logger: env.logger,
      schedule: env.scheduler.createScheduledTaskRunner({
        frequency: { minutes: 5 },
        timeout: { minutes: 6 },
      }),
      scheduler: env.scheduler,
    }),
  );
  const { processingEngine, router } = await builder.build();
  await processingEngine.start();
  return router;
}
#

maybe I'm missing some additonal precessor?

#

And also I can't find the actual data of catalog-info.yaml in Backstage DB. Generated locations doesn't contain actual data. What I'm missing?

tough condor
#

So, maybe it will help somebody. I've figured out the meaning of the warning:
catalog warn Entity 'component:default/payment-api' does not have the annotation backstage.io/managed-by-location type=plugin entity=component:default/payment-api location=undefined
In my case there was a relations prop which is PROHIBITED to be in catalog-info.yaml. Also annotations: []. While it is a valid YAML file, it is not valid for backstage schema. So, by removing relations and making annotations: (without braces) I've got my locations parsed.

#

And also when this bug happens, backstage continuously makes requests to github...

kindred gazelle
#

This is super helpful, thank you kyunle for sharing. I am also facing similar issue and I will be checking my catalog-info.yamls for relations property..

#

But, when I use sqlite db, my locations are parsed and processed. But not in postgres Db..