backstage

backstage.io add programatically


I'm trying to add backstage to an organisation - I was building something similar myself - so I have a bunch of metadata on hundreds of projects already in my own database.

I want to bulk add them to backstage - had a look at the catalog/entities API endpoint, and I can read the list of endpoints - but I can't figure out how to write one

Is the any way to programmatically create a component?


Solution

  • turns out it was really easy - you define all your entities in a yaml file - either one or multiple - and just add it as "location" - by posting to the /locations endpoint as documented here:

    https://backstage.io/docs/features/software-catalog/software-catalog-api/

    What's interesting is - if that location is in github - from then on backstage will notice changes.

    It was not obvious to me at all that to create a component you had to call the locations endpoint - but now I get that "locations" are basically "files that backstage knows about" - and it wants stuff to live in files, because it's designed to let you click edit and maintain something.