From 687fbe6284d51c14779399e52e9a2bd6fa123990 Mon Sep 17 00:00:00 2001 From: James Pace Date: Sat, 3 Dec 2022 22:28:30 -0500 Subject: [PATCH] Add test job for onedev integration. --- jobs/test-trigger-check.yaml | 23 +++++++++++++++ pipelines/test-pipeline.yaml | 41 ++++++++++++++++++++++++++ triggers/test-trigger.yaml | 56 ++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 jobs/test-trigger-check.yaml create mode 100644 pipelines/test-pipeline.yaml create mode 100644 triggers/test-trigger.yaml diff --git a/jobs/test-trigger-check.yaml b/jobs/test-trigger-check.yaml new file mode 100644 index 0000000..8a52b91 --- /dev/null +++ b/jobs/test-trigger-check.yaml @@ -0,0 +1,23 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: test-trigger-check +spec: + template: + spec: + containers: + - name: test-trigger-check + image: docker.io/debian:bullseye-slim + env: + - name: http_proxy + value: http://squid-service:3128 + command: ["bash"] + args: + - "-c" + - >- + apt update -y && + apt upgrade -y && + apt install -y curl && + curl -X POST http://el-test-pipeline-listener.default.svc.cluster.local:8080 -H 'Content-Type: application/json' -d '{}' + restartPolicy: Never + backoffLimit: 0 \ No newline at end of file diff --git a/pipelines/test-pipeline.yaml b/pipelines/test-pipeline.yaml new file mode 100644 index 0000000..57a87e0 --- /dev/null +++ b/pipelines/test-pipeline.yaml @@ -0,0 +1,41 @@ +# A pipeline to test the infrasture around calling pipelines. +--- +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: test-pipeline +spec: + description: "A test pipeline." + workspaces: + - name: shared-data + description: Shared data. + - name: git-credentials + description: tekton git credentials + tasks: + - name: fetch-repo + workspaces: + - name: output + workspace: shared-data + - name: ssh-directory + workspace: git-credentials + params: + - name: url + value: ssh://git.jpace121.net:2222/job-test + - name: branch + value: master + taskRef: + name: j7s-git-clone + - name: cat-readme + runAfter: ["fetch-repo"] + workspaces: + - name: source + workspace: shared-data + taskSpec: + workspaces: + - name: source + steps: + - image: docker.io/debian:bullseye-slim + script: | + set -x + cat $(workspaces.source.path)/README.md + exit 0 diff --git a/triggers/test-trigger.yaml b/triggers/test-trigger.yaml new file mode 100644 index 0000000..97a2424 --- /dev/null +++ b/triggers/test-trigger.yaml @@ -0,0 +1,56 @@ +--- +apiVersion: triggers.tekton.dev/v1beta1 +kind: EventListener +metadata: + name: test-pipeline-listener +spec: + serviceAccountName: tekton-bot + triggers: + - name: test-pipeline-trigger + bindings: + - ref: test-pipeline-binding + template: + ref: test-pipeline-template + resources: + kubernetesResource: + serviceType: ClusterIP +--- +apiVersion: triggers.tekton.dev/v1beta1 +kind: TriggerBinding +metadata: + name: test-pipeline-binding +spec: + params: + - name: empty + value: empty +--- +apiVersion: triggers.tekton.dev/v1beta1 +kind: TriggerTemplate +metadata: + name: test-pipeline-template +spec: + params: + - name: should-fail + resourcetemplates: + - apiVersion: tekton.dev/v1beta1 + kind: PipelineRun + metadata: + generateName: test-pipeline- + spec: + pipelineRef: + name: test-pipeline + params: + - name: should-fail + value: "$(tt.params.should-fail)" + workspaces: + - name: shared-data + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + - name: git-credentials + secret: + secretName: git-credentials \ No newline at end of file