From 556a5d4be483a68112a4592ffa6cf7f69d7030ca Mon Sep 17 00:00:00 2001 From: Jason Power Date: Fri, 8 Dec 2023 14:00:40 +0000 Subject: [PATCH] re-add unit tests (#106) --- .tekton/cosign-cli-2-2-pull-request.yaml | 15 +++++++++++++++ .tekton/cosign-cli-2-2-push.yaml | 15 +++++++++++++++ .tekton/cosign-unit-test.yaml | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 .tekton/cosign-unit-test.yaml diff --git a/.tekton/cosign-cli-2-2-pull-request.yaml b/.tekton/cosign-cli-2-2-pull-request.yaml index 5417d440ed8..b0866829b36 100644 --- a/.tekton/cosign-cli-2-2-pull-request.yaml +++ b/.tekton/cosign-cli-2-2-pull-request.yaml @@ -383,6 +383,21 @@ spec: operator: in values: - "false" + - name: run-unit-test + runAfter: + - prefetch-dependencies + taskRef: + params: + - name: name + value: go-unit-test + - name: bundle + value: quay.io/securesign/cosign-unit-test:latest + - name: kind + value: task + resolver: bundles + workspaces: + - name: source + workspace: workspace workspaces: - name: workspace - name: git-auth diff --git a/.tekton/cosign-cli-2-2-push.yaml b/.tekton/cosign-cli-2-2-push.yaml index 7b1346985f5..939fa5ee63d 100644 --- a/.tekton/cosign-cli-2-2-push.yaml +++ b/.tekton/cosign-cli-2-2-push.yaml @@ -380,6 +380,21 @@ spec: operator: in values: - "false" + - name: run-unit-test + runAfter: + - prefetch-dependencies + taskRef: + params: + - name: name + value: go-unit-test + - name: bundle + value: quay.io/securesign/cosign-unit-test:latest + - name: kind + value: task + resolver: bundles + workspaces: + - name: source + workspace: workspace workspaces: - name: workspace - name: git-auth diff --git a/.tekton/cosign-unit-test.yaml b/.tekton/cosign-unit-test.yaml new file mode 100644 index 00000000000..c2cb7972587 --- /dev/null +++ b/.tekton/cosign-unit-test.yaml @@ -0,0 +1,20 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: go-unit-test + annotations: + tekton.dev/title: "Go Unit Test Task" +spec: + workspaces: + - name: source + steps: + - name: run-tests + image: registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca + workingDir: $(workspaces.source.path)/source + script: | + #!/usr/bin/env sh + go test ./... + +# This file bundles the unit tests for cosign. +# If any changes are made to this file, it must be pushed to Quay using the following command: +# 'tkn bundle push quay.io/securesign/cosign-unit-test:latest -f .tekton/cosign-unit-test.yaml'. \ No newline at end of file