Skip to content

Commit eb0f886

Browse files
committed
Refactor tests pipeline run
1 parent 1d51aaf commit eb0f886

12 files changed

+582
-681
lines changed

.tekton/pipeline-service-test.yaml

Lines changed: 11 additions & 312 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,19 @@ metadata:
66
annotations:
77
pipelinesascode.tekton.dev/on-event: "[pull_request, push]"
88
pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/*]"
9-
pipelinesascode.tekton.dev/task: "[git-clone]"
9+
pipelinesascode.tekton.dev/pipeline: "[.tekton/pipeline/acceptance-tests.yaml]"
10+
pipelinesascode.tekton.dev/task: "[.tekton/tasks/ci-runner-container-setup.yaml]"
11+
pipelinesascode.tekton.dev/task-1: "[.tekton/tasks/deploy-cluster.yaml]"
12+
pipelinesascode.tekton.dev/task-2: "[.tekton/tasks/destroy-cluster.yaml]"
13+
pipelinesascode.tekton.dev/task-3: "[.tekton/tasks/destroy-existing-cluster.yaml]"
14+
pipelinesascode.tekton.dev/task-4: "[.tekton/tasks/generate-cluster-name.yaml]"
15+
pipelinesascode.tekton.dev/task-5: "[.tekton/tasks/pipeline-service-setup.yaml]"
16+
pipelinesascode.tekton.dev/task-6: "[.tekton/tasks/pipeline-service-tests.yaml]"
17+
pipelinesascode.tekton.dev/task-7: "[git-clone]"
1018
pipelinesascode.tekton.dev/max-keep-runs: "5"
1119
spec:
20+
pipelineRef:
21+
name: acceptance-tests
1222
params:
1323
- name: repo_url
1424
value: "{{ repo_url }}"
@@ -18,317 +28,6 @@ spec:
1828
value: "{{ target_branch }}"
1929
timeouts:
2030
pipeline: "1h0m0s"
21-
finally: "0h20m0s"
22-
pipelineSpec:
23-
params:
24-
- name: repo_url
25-
- name: revision
26-
- name: target_branch
27-
workspaces:
28-
- name: source
29-
- name: kubeconfig-dir
30-
- name: shared-workspace
31-
tasks:
32-
- name: produce-cluster-name
33-
runAfter:
34-
- "fetch-repository"
35-
taskSpec:
36-
results:
37-
- name: cluster-name
38-
description: Openshift cluster name
39-
steps:
40-
- name: cluster-name
41-
image: registry.access.redhat.com/ubi9/openssl:9.1-2
42-
script: |
43-
#!/usr/bin/env bash
44-
set -o errexit
45-
set -o nounset
46-
set -o pipefail
47-
set -x
48-
CLUSTER_NAME="ci-$( openssl rand -hex 5 )"
49-
echo -n "$CLUSTER_NAME" | tee $(results.cluster-name.path)
50-
- name: clean-clusters
51-
runAfter:
52-
- "fetch-repository"
53-
params:
54-
- name: target_branch
55-
value: $(params.target_branch)
56-
workspaces:
57-
- name: kubeconfig-dir
58-
workspace: kubeconfig-dir
59-
- name: source
60-
workspace: source
61-
taskSpec:
62-
params:
63-
- name: target_branch
64-
workspaces:
65-
- name: kubeconfig-dir
66-
- name: source
67-
kind: ClusterTask
68-
steps:
69-
- name: destroy-clusters
70-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
71-
env:
72-
- name: "KUBECONFIG"
73-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
74-
- name: BW_CLIENTID
75-
valueFrom:
76-
secretKeyRef:
77-
name: hypershift-bitwarden
78-
key: "BW_CLIENTID"
79-
- name: BW_CLIENTSECRET
80-
valueFrom:
81-
secretKeyRef:
82-
name: hypershift-bitwarden
83-
key: "BW_CLIENTSECRET"
84-
- name: BW_PASSWORD
85-
valueFrom:
86-
secretKeyRef:
87-
name: hypershift-bitwarden
88-
key: "BW_PASSWORD"
89-
command:
90-
- $(workspaces.source.path)/ci/images/ci-runner/hack/bin/destroy-clusters.sh
91-
- name: deploy-cluster
92-
runAfter:
93-
- "produce-cluster-name"
94-
params:
95-
- name: image
96-
value: "quay.io/openshift-release-dev/ocp-release:4.12.2-x86_64"
97-
- name: region
98-
value: "us-east-1"
99-
- name: cluster-name
100-
value: "$(tasks.produce-cluster-name.results.cluster-name)"
101-
- name: target_branch
102-
value: $(params.target_branch)
103-
workspaces:
104-
- name: kubeconfig-dir
105-
workspace: kubeconfig-dir
106-
- name: output
107-
workspace: shared-workspace
108-
- name: source
109-
workspace: source
110-
taskSpec:
111-
params:
112-
- name: region
113-
- name: cluster-name
114-
- name: image
115-
- name: target_branch
116-
results:
117-
- name: kubeconfig
118-
description: the kubeconfig content of the new OCP cluster
119-
workspaces:
120-
- name: kubeconfig-dir
121-
- name: output
122-
- name: source
123-
description: The kubeconfig of new cluster will be stored onto the volume backing this Workspace
124-
kind: ClusterTask
125-
steps:
126-
- name: deploy-cluster
127-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
128-
imagePullPolicy: Always
129-
env:
130-
- name: KUBECONFIG
131-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
132-
- name: CLUSTER_NAME
133-
value: "$(params.cluster-name)"
134-
- name: WORKSPACE
135-
value: "$(workspaces.output.path)"
136-
- name: REGION
137-
value: "$(params.region)"
138-
- name: IMAGE
139-
value: "$(params.image)"
140-
- name: BW_CLIENTID
141-
valueFrom:
142-
secretKeyRef:
143-
name: hypershift-bitwarden
144-
key: "BW_CLIENTID"
145-
- name: BW_CLIENTSECRET
146-
valueFrom:
147-
secretKeyRef:
148-
name: hypershift-bitwarden
149-
key: "BW_CLIENTSECRET"
150-
- name: BW_PASSWORD
151-
valueFrom:
152-
secretKeyRef:
153-
name: hypershift-bitwarden
154-
key: "BW_PASSWORD"
155-
command:
156-
- $(workspaces.source.path)/ci/images/ci-runner/hack/bin/deploy-cluster.sh
157-
- name: fetch-repository
158-
taskRef:
159-
name: git-clone
160-
kind: ClusterTask
161-
workspaces:
162-
- name: output
163-
workspace: source
164-
params:
165-
- name: url
166-
value: $(params.repo_url)
167-
- name: revision
168-
value: $(params.revision)
169-
- name: setup-ci-runner-container
170-
runAfter:
171-
- "deploy-cluster"
172-
params:
173-
- name: target_branch
174-
value: $(params.target_branch)
175-
workspaces:
176-
- name: source
177-
workspace: source
178-
- name: kubeconfig-dir
179-
workspace: shared-workspace
180-
taskSpec:
181-
params:
182-
- name: target_branch
183-
workspaces:
184-
- name: source
185-
- name: kubeconfig-dir
186-
kind: ClusterTask
187-
steps:
188-
- name: create-ci-runner-container
189-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
190-
resources:
191-
requests:
192-
memory: 500Mi
193-
cpu: 300m
194-
env:
195-
- name: KUBECONFIG
196-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
197-
script: |
198-
$(workspaces.source.path)/ci/images/ci-runner/hack/bin/create-ci-runner-container.sh
199-
- name: copy-plnsvc-code
200-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
201-
resources:
202-
requests:
203-
memory: 500Mi
204-
cpu: 300m
205-
workingDir: "$(workspaces.source.path)"
206-
env:
207-
- name: KUBECONFIG
208-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
209-
command:
210-
- $(workspaces.source.path)/ci/images/ci-runner/hack/bin/copy-plnsvc-code.sh
211-
- name: plnsvc-setup
212-
runAfter:
213-
- "setup-ci-runner-container"
214-
workspaces:
215-
- name: kubeconfig-dir
216-
workspace: shared-workspace
217-
- name: source
218-
workspace: source
219-
params:
220-
- name: repo_url
221-
value: $(params.repo_url)
222-
- name: revision
223-
value: $(params.revision)
224-
- name: target_branch
225-
value: $(params.target_branch)
226-
taskSpec:
227-
workspaces:
228-
- name: kubeconfig-dir
229-
- name: source
230-
params:
231-
- name: repo_url
232-
- name: revision
233-
- name: target_branch
234-
kind: ClusterTask
235-
steps:
236-
- name: run-plnsvc-setup
237-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
238-
resources:
239-
requests:
240-
memory: 500Mi
241-
cpu: 300m
242-
workingDir: "$(workspaces.source.path)"
243-
env:
244-
- name: KUBECONFIG
245-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
246-
- name: REPO_URL
247-
value: $(params.repo_url)
248-
- name: REPO_REVISION
249-
value: $(params.revision)
250-
command:
251-
- $(workspaces.source.path)/ci/images/ci-runner/hack/bin/run-plnsvc-setup.sh
252-
- name: tests
253-
runAfter:
254-
- "plnsvc-setup"
255-
params:
256-
- name: target_branch
257-
value: $(params.target_branch)
258-
workspaces:
259-
- name: kubeconfig-dir
260-
workspace: shared-workspace
261-
- name: source
262-
workspace: source
263-
taskSpec:
264-
params:
265-
- name: target_branch
266-
workspaces:
267-
- name: kubeconfig-dir
268-
- name: source
269-
kind: ClusterTask
270-
steps:
271-
- name: run-tests
272-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
273-
resources:
274-
requests:
275-
memory: 500Mi
276-
cpu: 300m
277-
workingDir: "$(workspaces.source.path)"
278-
env:
279-
- name: KUBECONFIG
280-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
281-
command:
282-
- $(workspaces.source.path)/ci/images/ci-runner/hack/bin/run-tests.sh
283-
finally:
284-
- name: destroy-cluster
285-
when:
286-
- input: "$(tasks.deploy-cluster.status)"
287-
operator: notin
288-
values: ["None"]
289-
params:
290-
- name: cluster-name
291-
value: "$(tasks.produce-cluster-name.results.cluster-name)"
292-
- name: target_branch
293-
value: $(params.target_branch)
294-
workspaces:
295-
- name: kubeconfig-dir
296-
workspace: kubeconfig-dir
297-
- name: source
298-
workspace: source
299-
taskSpec:
300-
params:
301-
- name: cluster-name
302-
- name: target_branch
303-
workspaces:
304-
- name: kubeconfig-dir
305-
- name: source
306-
kind: ClusterTask
307-
steps:
308-
- name: destroy
309-
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
310-
env:
311-
- name: KUBECONFIG
312-
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
313-
- name: CLUSTER_NAME
314-
value: "$(params.cluster-name)"
315-
- name: BW_CLIENTID
316-
valueFrom:
317-
secretKeyRef:
318-
name: hypershift-bitwarden
319-
key: "BW_CLIENTID"
320-
- name: BW_CLIENTSECRET
321-
valueFrom:
322-
secretKeyRef:
323-
name: hypershift-bitwarden
324-
key: "BW_CLIENTSECRET"
325-
- name: BW_PASSWORD
326-
valueFrom:
327-
secretKeyRef:
328-
name: hypershift-bitwarden
329-
key: "BW_PASSWORD"
330-
command:
331-
- $(workspaces.source.path)/ci/images/ci-runner/hack/bin/destroy-cluster.sh
33231
workspaces:
33332
- name: kubeconfig-dir
33433
configMap:

0 commit comments

Comments
 (0)