From 81cb294dacbf23bc863afb3b287a24ff9a68d61b Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 1 Sep 2020 10:36:21 +0200 Subject: [PATCH] config,docs: add templates as allowed kind and document process --- app-config.yaml | 2 ++ .../software-catalog/configuration.md | 4 ++-- .../software-templates/adding-templates.md | 22 +++++++++++++++++++ .../templates/default-app/app-config.yaml.hbs | 5 +++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index 3b3733cf54..ba556873aa 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -48,6 +48,8 @@ lighthouse: baseUrl: http://localhost:3003 catalog: + rules: + allow: [Component, API, Group, Template] processors: githubApi: privateToken: diff --git a/docs/features/software-catalog/configuration.md b/docs/features/software-catalog/configuration.md index d4cc7fc0c2..acfaf115de 100644 --- a/docs/features/software-catalog/configuration.md +++ b/docs/features/software-catalog/configuration.md @@ -32,7 +32,7 @@ For example, given the following configuration: ```yaml catalog: rules: - - allow: [Component, API, System] + - allow: [Component, API, Template] locations: - type: github @@ -40,7 +40,7 @@ catalog: allow: [Group] ``` -We are able to add entities of kind `Component`, `API`, or `System` from any +We are able to add entities of kind `Component`, `API`, or `Template` from any location, and `Group` entities from the `org-data.yaml`, which will also be read as statically configured location. diff --git a/docs/features/software-templates/adding-templates.md b/docs/features/software-templates/adding-templates.md index 67467bd98e..16419b4dfe 100644 --- a/docs/features/software-templates/adding-templates.md +++ b/docs/features/software-templates/adding-templates.md @@ -58,6 +58,28 @@ Currently the catalog supports loading definitions from GitHub + Local Files. To load from other places, not only will there need to be another preparer, but the support to load the location will also need to be added to the Catalog. +You can add the template files to the catalog through +[static location configuration](../software-catalog/configuration.md#static-location-configuration), +for example + +```yaml +catalog: + locations: + - type: github + target: https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml + allow: [Template] +``` + +Templates can also be added by posting the to the catalog directly. Note that if +you're doing this, you need to configure the catalog to allow template entities +to be ingested from any source, for example: + +```yaml +catalog: + rules: + allow: [Component, API, Template] +``` + For loading from a file, the following command should work when the backend is running: diff --git a/packages/create-app/templates/default-app/app-config.yaml.hbs b/packages/create-app/templates/default-app/app-config.yaml.hbs index aff375ad29..e194295df3 100644 --- a/packages/create-app/templates/default-app/app-config.yaml.hbs +++ b/packages/create-app/templates/default-app/app-config.yaml.hbs @@ -69,11 +69,16 @@ catalog: # Backstage example templates - type: github target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml + allow: [Template] - type: github target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml + allow: [Template] - type: github target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml + allow: [Template] - type: github target: https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml + allow: [Template] - type: github target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml + allow: [Template]