diff --git a/plugins/scaffolder-backend/sample-templates/docs-template/skeleton/catalog-info.yaml b/plugins/scaffolder-backend/sample-templates/docs-template/skeleton/catalog-info.yaml index 2f9ce4d153..7233525ac5 100644 --- a/plugins/scaffolder-backend/sample-templates/docs-template/skeleton/catalog-info.yaml +++ b/plugins/scaffolder-backend/sample-templates/docs-template/skeleton/catalog-info.yaml @@ -1,11 +1,11 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: - name: {{cookiecutter.component_id | jsonify}} + name: {{cookiecutter.name | jsonify}} description: {{cookiecutter.description | jsonify}} annotations: - github.com/project-slug: {{cookiecutter.destination.git.owner + "/" + cookiecutter.destination.git.name}} - backstage.io/techdocs-ref: url:{{cookiecutter.storePath}} + github.com/project-slug: {{cookiecutter.destination.owner + "/" + cookiecutter.destination.repo}} + backstage.io/techdocs-ref: url:{{"https://" + cookiecutter.destination.host + "/" + cookiecutter.destination.owner + "/" + cookiecutter.destination.repo}} spec: type: documentation lifecycle: experimental diff --git a/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml b/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml index dcfa667c9f..7b3d58d0b3 100644 --- a/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml +++ b/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml @@ -32,6 +32,25 @@ spec: ui:autofocus: true ui:options: rows: 5 + owner: + title: Owner + type: string + description: Owner of the component + ui:field: OwnerPicker + ui:options: + allowedKinds: + - Group + - title: Choose a location + required: + - repoUrl + properties: + repoUrl: + title: Repository Location + type: string + ui:field: RepoUrlPicker + ui:options: + allowedHosts: + - github.com # This template is meant to be used on top of an existing tmeplate. # By adding the following and fetching from an absolute URL you can @@ -45,4 +64,24 @@ spec: values: name: '{{ parameters.name }}' description: '{{ parameters.description }}' + destination: '{{ parseRepoUrl parameters.repoUrl }}' + owner: '{{ parameters.owner }}' + - id: publish + name: Publish + action: publish:github + input: + allowedHosts: ['github.com'] + description: 'This is {{ parameters.component_id }}' + repoUrl: '{{ parameters.repoUrl }}' + + - id: register + name: Register + action: catalog:register + input: + repoContentsUrl: '{{ steps.publish.output.repoContentsUrl }}' + catalogInfoPath: '/catalog-info.yaml' + + output: + remoteUrl: '{{ steps.publish.output.remoteUrl }}' + entityRef: '{{ steps.register.output.entityRef }}'