From 0c8bfbb6721bffe7e9574153eaa93a6c62f9bb2d Mon Sep 17 00:00:00 2001 From: Paul Schultz Date: Tue, 29 Aug 2023 13:31:30 -0500 Subject: [PATCH 1/4] feat(tekton): add tekton gpt Signed-off-by: Paul Schultz --- templates/github/tekton/template.yaml | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 templates/github/tekton/template.yaml diff --git a/templates/github/tekton/template.yaml b/templates/github/tekton/template.yaml new file mode 100644 index 00000000..b111c4d4 --- /dev/null +++ b/templates/github/tekton/template.yaml @@ -0,0 +1,62 @@ +apiVersion: scaffolder.backstage.io/v1beta3 +kind: Template +metadata: + name: tekton-template + title: Create a tekton sample + description: Create a tekton sample + tags: + - ci + - tekton +spec: + owner: janus-authors + system: janus-idp + type: service + + parameters: + - title: Provide information about the existing component + required: + - orgName + - repoName + - prBranch + - catalogInfoPath + properties: + orgName: + title: Organization + type: string + repoName: + title: Repository + type: string + prBranch: + title: Pull Request Branch + type: string + default: add-tekton + catalogInfoPath: + title: Catalog Info Path + type: string + default: /catalog-info.yaml + + steps: + - id: fetchRepo + name: Fetch repo + action: fetch:plain + input: + url: 'https://github.com/${{ parameters.orgName }}/${{ parameters.repoName }}' + + - id: merge + name: Merge JSON + action: roadiehq:utils:json:merge + input: + path: ${{ parameters.catalogInfoPath }} + content: + metadata: + annotations: + tektonci/build-namespace: test + + - id: publishPR + name: Publish PR + action: publish:github:pull-request + input: + repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.orgName }} + branchName: ${{ parameters.prBranch }} + title: Add Tekton + description: This PR was created by a Backstage scaffolder task From 22a693d11edfdc30ee6d83ee09e0cbe92538d3e7 Mon Sep 17 00:00:00 2001 From: Paul Schultz Date: Thu, 31 Aug 2023 11:10:57 -0500 Subject: [PATCH 2/4] update merge yaml step Signed-off-by: Paul Schultz --- templates/github/tekton/template.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/github/tekton/template.yaml b/templates/github/tekton/template.yaml index b111c4d4..b76ed6cd 100644 --- a/templates/github/tekton/template.yaml +++ b/templates/github/tekton/template.yaml @@ -33,18 +33,18 @@ spec: catalogInfoPath: title: Catalog Info Path type: string - default: /catalog-info.yaml + default: catalog-info.yaml steps: - id: fetchRepo - name: Fetch repo + name: Fetch Repo action: fetch:plain input: url: 'https://github.com/${{ parameters.orgName }}/${{ parameters.repoName }}' - id: merge - name: Merge JSON - action: roadiehq:utils:json:merge + name: Merge YAML + action: roadiehq:utils:merge input: path: ${{ parameters.catalogInfoPath }} content: From 051fbc0bbd9210ca1cdd0649678ef2bcba7ab687 Mon Sep 17 00:00:00 2001 From: Paul Schultz Date: Thu, 31 Aug 2023 16:15:45 -0500 Subject: [PATCH 3/4] add ci templating Signed-off-by: Paul Schultz --- templates/github/tekton/template.yaml | 54 ++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/templates/github/tekton/template.yaml b/templates/github/tekton/template.yaml index b76ed6cd..deb01cf2 100644 --- a/templates/github/tekton/template.yaml +++ b/templates/github/tekton/template.yaml @@ -35,6 +35,41 @@ spec: type: string default: catalog-info.yaml + - title: Provide information about the CI method + required: + - imageBuilder + - imageRepository + - imageUrl + - namespace + - port + properties: + imageBuilder: + title: Image Builder + type: string + description: The Source-To-Image (S2I) builder to use + imageRepository: + title: Select a registry + type: string + default: quay.io + enum: + - quay.io + - image-registry.openshift-image-registry.svc:5000 + enumNames: + - Quay + - Internal OpenShift Registry + imageUrl: + title: Image URL + type: string + description: The Quay.io or OpenShift Image URL // + namespace: + title: Namespace + type: string + description: The namespace for deploying resources + port: + title: Port + type: number + description: The port exposed for the application + steps: - id: fetchRepo name: Fetch Repo @@ -50,7 +85,22 @@ spec: content: metadata: annotations: - tektonci/build-namespace: test + tektonci/build-namespace: ${{ parameters.namespace }} + + - id: ciTemplate + name: Generating the CI Component + action: fetch:template + input: + url: ../../../skeletons/tekton/ + values: + orgName: ${{ parameters.orgName }} + repoName: ${{ parameters.repoName }} + imageBuilder: ${{ parameters.imageBuilder }} + imageUrl: ${{ parameters.imageUrl }} + imageRepository: ${{ parameters.imageRepository }} + namespace: ${{ parameters.namespace }} + port: ${{ parameters.port }} + sourceControl: github.com - id: publishPR name: Publish PR @@ -59,4 +109,4 @@ spec: repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.orgName }} branchName: ${{ parameters.prBranch }} title: Add Tekton - description: This PR was created by a Backstage scaffolder task + description: This PR was created by a Backstage scaffolder task to add Tekton to the project. From 3d9682e3bdd45a6eaf5dd0dfe5fb18b4f25452de Mon Sep 17 00:00:00 2001 From: Paul Schultz Date: Thu, 31 Aug 2023 16:19:30 -0500 Subject: [PATCH 4/4] add to showcase templates Signed-off-by: Paul Schultz --- showcase-templates.yaml | 1 + templates/github/tekton/template.yaml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/showcase-templates.yaml b/showcase-templates.yaml index 4acafd65..0f4bb1bb 100644 --- a/showcase-templates.yaml +++ b/showcase-templates.yaml @@ -16,3 +16,4 @@ spec: - https://github.com/janus-idp/software-templates/blob/main/templates/github/launch-ansible-job/template.yaml - https://github.com/janus-idp/software-templates/blob/main/templates/github/define-ansible-job/template.yaml - https://github.com/janus-idp/software-templates/blob/main/templates/github/register-component/template.yaml + - https://github.com/janus-idp/software-templates/blob/main/templates/github/tekton/template.yaml diff --git a/templates/github/tekton/template.yaml b/templates/github/tekton/template.yaml index deb01cf2..1a25ba6f 100644 --- a/templates/github/tekton/template.yaml +++ b/templates/github/tekton/template.yaml @@ -2,8 +2,8 @@ apiVersion: scaffolder.backstage.io/v1beta3 kind: Template metadata: name: tekton-template - title: Create a tekton sample - description: Create a tekton sample + title: Create a tekton CI Pipeline + description: Create a tekton CI Pipeline tags: - ci - tekton