From 94b8589b7c0e1a6e83aba5b5b32c863e6f9e1452 Mon Sep 17 00:00:00 2001 From: vcarroy Date: Mon, 24 Mar 2025 16:46:27 +0100 Subject: [PATCH] --wip-- [skip ci] --- kustomization.yaml | 13 +++++++++ resources/pipeline/test-clone.yaml | 33 +++++++++++++++++++++++ resources/pipelinerun/test-clone-run.yaml | 24 +++++++++++++++++ resources/task/common/show-readme.yaml | 14 ++++++++++ secrets/.gitignore | 1 + secrets/gitcred.txt.dist | 3 +++ 6 files changed, 88 insertions(+) create mode 100644 kustomization.yaml create mode 100644 resources/pipeline/test-clone.yaml create mode 100644 resources/pipelinerun/test-clone-run.yaml create mode 100644 resources/task/common/show-readme.yaml create mode 100644 secrets/.gitignore create mode 100644 secrets/gitcred.txt.dist diff --git a/kustomization.yaml b/kustomization.yaml new file mode 100644 index 0000000..2a2396e --- /dev/null +++ b/kustomization.yaml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://storage.googleapis.com/tekton-releases/operator/latest/release.yaml + - https://raw.githubusercontent.com/tektoncd/operator/main/config/crs/kubernetes/config/all/operator_v1alpha1_config_cr.yaml + # Catalog + - https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.6/git-clone.yaml + +secretGenerator: + - name: git-credentials + envs: + - secrets/gitcred.txt \ No newline at end of file diff --git a/resources/pipeline/test-clone.yaml b/resources/pipeline/test-clone.yaml new file mode 100644 index 0000000..a5ebdf8 --- /dev/null +++ b/resources/pipeline/test-clone.yaml @@ -0,0 +1,33 @@ +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: test-clone +spec: + description: | + This pipeline clones a git repo, then echoes the README file to the stdout. + params: + - name: repo-url + type: string + description: The git repo URL to clone from. + workspaces: + - name: shared-data + description: | + This workspace contains the cloned repo files, so they can be read by the + next task. + tasks: + - name: git-clone + taskRef: + name: git-clone + workspaces: + - name: output + workspace: shared-data + params: + - name: url + value: $(params.repo-url) + - name: show-readme + runAfter: ["git-clone"] + taskRef: + name: show-readme + workspace: + - name: source + workspace: shared-data \ No newline at end of file diff --git a/resources/pipelinerun/test-clone-run.yaml b/resources/pipelinerun/test-clone-run.yaml new file mode 100644 index 0000000..2f1e8ff --- /dev/null +++ b/resources/pipelinerun/test-clone-run.yaml @@ -0,0 +1,24 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + generateName: test-clone-run- + +spec: + pipelineRef: + name: test-clone + podTemplate: + securityContext: + fsGroup: 65532 + workspaces: + - name: shared-data + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + - name: git-credentials + params: + - name: repo-url + value: https://forge.cadoles.com/CNOUS/mse.git \ No newline at end of file diff --git a/resources/task/common/show-readme.yaml b/resources/task/common/show-readme.yaml new file mode 100644 index 0000000..f472773 --- /dev/null +++ b/resources/task/common/show-readme.yaml @@ -0,0 +1,14 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: show-readme +spec: + description: Read and display README file. + workspaces: + - name: source + steps: + - name: read + image: alpine:latest + script: | + #!/usr/bin/env sh + cat $(workspaces.source.path)/README.md \ No newline at end of file diff --git a/secrets/.gitignore b/secrets/.gitignore new file mode 100644 index 0000000..f242fc7 --- /dev/null +++ b/secrets/.gitignore @@ -0,0 +1 @@ +/gitcred.txt \ No newline at end of file diff --git a/secrets/gitcred.txt.dist b/secrets/gitcred.txt.dist new file mode 100644 index 0000000..5fa8af1 --- /dev/null +++ b/secrets/gitcred.txt.dist @@ -0,0 +1,3 @@ +id_rsa= +known_hosts= +config= \ No newline at end of file