Skip to content

Commit b53cf48

Browse files
committed
add tekton results upstream e2e to acceptance test
- Run tekton results upstream e2e test on sha update in pipeline service - Refer PLNSRVCE-1182 Signed-off-by: Avinal Kumar <[email protected]>
1 parent 05a881b commit b53cf48

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed

.tekton/pipeline-service-test.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ metadata:
1414
pipelinesascode.tekton.dev/task-4: "[.tekton/tasks/generate-cluster-name.yaml]"
1515
pipelinesascode.tekton.dev/task-5: "[.tekton/tasks/pipeline-service-setup.yaml]"
1616
pipelinesascode.tekton.dev/task-6: "[.tekton/tasks/pipeline-service-tests.yaml]"
17-
pipelinesascode.tekton.dev/task-7: "[git-clone]"
17+
pipelinesascode.tekton.dev/task-7: "[.tekton/tasks/tekton-results-fetch-sha.yaml]"
18+
pipelinesascode.tekton.dev/task-8: "[.tekton/tasks/tekton-results-upstream-e2e.yaml]"
19+
pipelinesascode.tekton.dev/task-9: "[git-clone]"
1820
pipelinesascode.tekton.dev/max-keep-runs: "5"
1921
spec:
2022
pipelineRef:
@@ -26,6 +28,8 @@ spec:
2628
value: "{{ revision }}"
2729
- name: target_branch
2830
value: "{{ target_branch }}"
31+
- name: results_url
32+
value: "https://github.com/openshift-pipelines/tektoncd-results"
2933
timeouts:
3034
pipeline: "1h0m0s"
3135
workspaces:
@@ -48,3 +52,11 @@ spec:
4852
resources:
4953
requests:
5054
storage: 50Mi
55+
- name: tekton-results-source
56+
volumeClaimTemplate:
57+
spec:
58+
accessModes:
59+
- ReadWriteOnce
60+
resources:
61+
requests:
62+
storage: 3Gi

.tekton/pipeline/acceptance-tests.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ spec:
88
- name: repo_url
99
- name: revision
1010
- name: target_branch
11+
- name: results_url
1112
timeouts:
1213
finally: "0h20m0s"
1314
workspaces:
1415
- name: source
16+
- name: tekton-results-source
1517
- name: kubeconfig-dir
1618
- name: shared-workspace
1719
tasks:
@@ -107,6 +109,45 @@ spec:
107109
workspace: shared-workspace
108110
- name: source
109111
workspace: source
112+
- name: tekton-results-fetch-sha
113+
taskRef:
114+
name: tekton-results-fetch-sha
115+
runAfter:
116+
- "clone-pipeline-service-git"
117+
params:
118+
- name: target_branch
119+
value: $(params.target_branch)
120+
workspaces:
121+
- name: source
122+
workspace: source
123+
- name: clone-downstream-tekton-results
124+
taskRef:
125+
name: git-cli
126+
kind: ClusterTask
127+
runAfter:
128+
- "tekton-results-fetch-sha"
129+
params:
130+
- name: GIT_SCRIPT
131+
value: |
132+
git fetch origin "$(params.results_url)"
133+
git checkout "$(tasks.tekton-results-fetch-sha.results.tekton-results-downstream-sha)"
134+
workspaces:
135+
- name: output
136+
workspace: tekton-results-source
137+
- name: tekton-results-upstream-e2e
138+
taskRef:
139+
name: tekton-results-upstream-e2e
140+
runAfter:
141+
- "clone-downstream-tekton-results"
142+
- "plnsvc-setup"
143+
params:
144+
- name: target_branch
145+
value: $(params.target_branch)
146+
workspaces:
147+
- name: source
148+
workspace: tekton-results-source
149+
- name: kubeconfig-dir
150+
workspace: kubeconfig-dir
110151
finally:
111152
- name: destroy-cluster
112153
taskRef:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
apiVersion: tekton.dev/v1beta1
3+
kind: Task
4+
metadata:
5+
name: tekton-results-fetch-sha
6+
spec:
7+
workspaces:
8+
- name: source
9+
params:
10+
- name: target_branch
11+
results:
12+
- name: tekton-results-downstream-sha
13+
description: Tekton Results updated SHA in Pipeline Service
14+
steps:
15+
- name: fetch-results-sha
16+
workingDir: $(workspaces.source.path)
17+
image: quay.io/openshift-pipeline/ci:latest
18+
script: |
19+
#! /usr/bin/env bash
20+
yq '.images[0].newTag' $(workspaces.source.path)/operator/gitops/argocd/pipeline-service/tekton-results/base/kustomization.yaml | tee $(results.tekton-results-downstream-sha.path)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
apiVersion: tekton.dev/v1beta1
3+
kind: Task
4+
metadata:
5+
name: tekton-results-upstream-e2e
6+
spec:
7+
params:
8+
- name: target_branch
9+
workspaces:
10+
- name: source
11+
- name: kubeconfig-dir
12+
steps:
13+
- name: execute-tekton-results-upstream-e2e
14+
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
15+
workingDir: $(workspaces.source.path)
16+
env:
17+
- name: KUBECONFIG
18+
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
19+
script: |
20+
#! /usr/bin/env bash
21+
export SA_TOKEN_PATH=${SA_TOKEN_PATH:-"/tmp/tekton-results/tokens"}
22+
mkdir -p ${SA_TOKEN_PATH}
23+
service_accounts=(all-namespaces-read-access single-namespace-read-access)
24+
for service_account in "${service_accounts[@]}"; do
25+
kubectl create token "$service_account" > "${SA_TOKEN_PATH}"/"$service_account"
26+
done
27+
export CGO_ENABLED=0
28+
go test -v -count=1 --tags=e2e $(workspaces.source.path)/test/e2e/...

0 commit comments

Comments
 (0)