From aeaa920a380e45a08a5dfd53c80f6b0821aa8075 Mon Sep 17 00:00:00 2001 From: Ryan Cook Date: Fri, 23 Jun 2023 09:19:22 -0400 Subject: [PATCH 1/4] define a playbook Signed-off-by: Ryan Cook --- .../skeleton/${{values.playbookName}}.yaml | 1 + .../ansible-playbook/template.yaml | 109 ++++++++++++++++++ showcase-templates.yaml | 1 + 3 files changed, 111 insertions(+) create mode 100644 scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml create mode 100644 scaffolder-templates/ansible-playbook/template.yaml diff --git a/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml b/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml new file mode 100644 index 00000000..b0d5bae5 --- /dev/null +++ b/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml @@ -0,0 +1 @@ +${{values.playbook}} \ No newline at end of file diff --git a/scaffolder-templates/ansible-playbook/template.yaml b/scaffolder-templates/ansible-playbook/template.yaml new file mode 100644 index 00000000..e1609a4b --- /dev/null +++ b/scaffolder-templates/ansible-playbook/template.yaml @@ -0,0 +1,109 @@ +apiVersion: scaffolder.backstage.io/v1beta3 +kind: Template +metadata: + name: ansible-playbook + title: Ansible Playbook + description: Upload an Ansible Playbook to Git + tags: + - recommended + - aap +spec: + owner: janus-authors + system: janus-idp + type: service + parameters: + - title: Provide information about the GitHub location + required: + - githubOrg + - repoName + - owner + - system + properties: + githubOrg: + title: GitHub Organization + type: string + owner: + title: Owner + type: string + description: Owner of the component + repoName: + title: Repository Name + type: string + system: + title: System + type: string + ui:field: EntityPicker + ui:options: + catalogFilter: + kind: + - System + - title: Ansible Playbook definition + required: + - playbook + - playbookName + - description + properties: + playbookName: + title: Playbook Name + type: string + description: Provide a name for the Ansible Playbook + playbook: + title: Playbook + type: string + description: Ansible Playbook definition + ui:widget: textarea + ui:options: + rows: 15 + description: + title: Description + type: string + description: Description of the Ansible Playbook + steps: + - id: template + name: Generating the source code component + action: fetch:template + input: + url: ./skeleton + targetPath: playbooks/ + values: + component_id: ${{ parameters.playbookName }} + name: ${{ parameters.playbookName }} + playbook: ${{ parameters.playbook }} + playbookName: ${{ parameters.playbookName }} + + - id: catalogTemplate + name: Generating the Catalog Info Component + action: fetch:template + input: + url: ../../scaffolder-skeletons/catalog-info-skeleton/ + values: + githubOrg: ${{ parameters.githubOrg }} + repoName: ${{ parameters.repoName }} + owner: ${{ parameters.owner }} + applicationType: api + description: ${{ parameters.description }} + + - id: publish + name: Publishing to Source Code Repository + action: publish:github:pull-request + input: + allowedHosts: ['github.com'] + title: ${{ parameters.playbookName }} + description: ${{ parameters.description }} + repoUrl: github.com?owner=${{ parameters.githubOrg }}&repo=${{ parameters.repoName }} + branchName: ${{ parameters.playbookName }} + + - id: register + name: Registering the Catalog Info Component + action: catalog:register + input: + repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }} + catalogInfoPath: /catalog-info.yaml + + output: + links: + - title: Source Code Repository + url: ${{ steps.publish.output.remoteUrl }} + - title: Open the Catalog Info Component + icon: catalog + entityRef: ${{ steps.register.output.entityRef }} \ No newline at end of file diff --git a/showcase-templates.yaml b/showcase-templates.yaml index 3d176675..c0107016 100644 --- a/showcase-templates.yaml +++ b/showcase-templates.yaml @@ -14,3 +14,4 @@ spec: - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/quarkus-backend-template/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/argocd-template/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-job/template.yaml + - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-playbook/template.yaml From a53ec4d036a1b9dc78ca4dff9fbfb2c2743bcfb1 Mon Sep 17 00:00:00 2001 From: Ryan Cook Date: Thu, 27 Jul 2023 16:01:33 -0400 Subject: [PATCH 2/4] lint of file Signed-off-by: Ryan Cook --- .../ansible-playbook/skeleton/${{values.playbookName}}.yaml | 3 ++- scaffolder-templates/ansible-playbook/template.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml b/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml index b0d5bae5..7187adbd 100644 --- a/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml +++ b/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml @@ -1 +1,2 @@ -${{values.playbook}} \ No newline at end of file +${{values.playbook}} + diff --git a/scaffolder-templates/ansible-playbook/template.yaml b/scaffolder-templates/ansible-playbook/template.yaml index e1609a4b..e7747b89 100644 --- a/scaffolder-templates/ansible-playbook/template.yaml +++ b/scaffolder-templates/ansible-playbook/template.yaml @@ -106,4 +106,5 @@ spec: url: ${{ steps.publish.output.remoteUrl }} - title: Open the Catalog Info Component icon: catalog - entityRef: ${{ steps.register.output.entityRef }} \ No newline at end of file + entityRef: ${{ steps.register.output.entityRef }} + From 41acbb948d551af9d8826f69d7b7533be2df9837 Mon Sep 17 00:00:00 2001 From: Ryan Cook Date: Thu, 27 Jul 2023 16:02:53 -0400 Subject: [PATCH 3/4] match upstream Signed-off-by: Ryan Cook --- showcase-templates.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/showcase-templates.yaml b/showcase-templates.yaml index c0107016..76dc36a9 100644 --- a/showcase-templates.yaml +++ b/showcase-templates.yaml @@ -14,4 +14,5 @@ spec: - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/quarkus-backend-template/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/argocd-template/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-job/template.yaml + - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-job-template/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-playbook/template.yaml From 4d4c79e1a793189720821832d7b6c0d1013212c5 Mon Sep 17 00:00:00 2001 From: Ryan Cook Date: Thu, 10 Aug 2023 15:48:06 -0400 Subject: [PATCH 4/4] fix of errors based on PR request --- .../ansible-playbook/template.yaml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/scaffolder-templates/ansible-playbook/template.yaml b/scaffolder-templates/ansible-playbook/template.yaml index e7747b89..e1fd0b3f 100644 --- a/scaffolder-templates/ansible-playbook/template.yaml +++ b/scaffolder-templates/ansible-playbook/template.yaml @@ -71,18 +71,6 @@ spec: playbook: ${{ parameters.playbook }} playbookName: ${{ parameters.playbookName }} - - id: catalogTemplate - name: Generating the Catalog Info Component - action: fetch:template - input: - url: ../../scaffolder-skeletons/catalog-info-skeleton/ - values: - githubOrg: ${{ parameters.githubOrg }} - repoName: ${{ parameters.repoName }} - owner: ${{ parameters.owner }} - applicationType: api - description: ${{ parameters.description }} - - id: publish name: Publishing to Source Code Repository action: publish:github:pull-request @@ -97,13 +85,13 @@ spec: name: Registering the Catalog Info Component action: catalog:register input: - repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }} + repoContentsUrl: ${{ steps.publish.output.repoUrl }} catalogInfoPath: /catalog-info.yaml output: links: - title: Source Code Repository - url: ${{ steps.publish.output.remoteUrl }} + url: ${{ steps.publish.output.repoUrl }} - title: Open the Catalog Info Component icon: catalog entityRef: ${{ steps.register.output.entityRef }}