-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathlightspeed-console-e2e-test-pipeline-pf5.yaml
More file actions
295 lines (295 loc) · 12.3 KB
/
lightspeed-console-e2e-test-pipeline-pf5.yaml
File metadata and controls
295 lines (295 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: ols-console-pre-commits
spec:
description: |
This pipeline automates the process of running end-to-end tests for OpenShift Lightspeed
using a ROSA (Red Hat OpenShift Service on AWS) cluster. The pipeline provisions
the ROSA cluster, installs the OpenShift Lightspeed operator using the installer, runs the tests, collects artifacts,
and finally deprovisions the ROSA cluster.
params:
- name: SNAPSHOT
description: 'The JSON string representing the snapshot of the application under test.'
default: '{"components": [{"name":"test-app", "containerImage": "quay.io/example/repo:latest"}]}'
type: string
- name: test-name
description: 'The name of the test corresponding to a defined Konflux integration test.'
default: 'ols-console-418'
- name: namespace
description: 'Namespace to run tests in'
default: 'openshift-lightspeed'
tasks:
- name: eaas-provision-space
taskRef:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/build-definitions.git
- name: revision
value: main
- name: pathInRepo
value: task/eaas-provision-space/0.1/eaas-provision-space.yaml
params:
- name: ownerKind
value: PipelineRun
- name: ownerName
value: $(context.pipelineRun.name)
- name: ownerUid
value: $(context.pipelineRun.uid)
- name: provision-cluster
runAfter:
- eaas-provision-space
taskSpec:
results:
- name: clusterName
value: "$(steps.create-cluster.results.clusterName)"
steps:
- name: pick-version
ref:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/build-definitions.git
- name: revision
value: main
- name: pathInRepo
value: stepactions/eaas-get-latest-openshift-version-by-prefix/0.1/eaas-get-latest-openshift-version-by-prefix.yaml
params:
- name: prefix
value: "4.18."
- name: create-cluster
ref:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/build-definitions.git
- name: revision
value: main
- name: pathInRepo
value: stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml
params:
- name: eaasSpaceSecretRef
value: $(tasks.eaas-provision-space.results.secretRef)
- name: version
value: "$(steps.pick-version.results.version)"
- name: instanceType
value: "m5.large"
- name: ols-install
description: Task to install bundle onto ephemeral namespace
runAfter:
- provision-cluster
params:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
- name: namespace
value: "$(params.namespace)"
taskSpec:
results:
- name: bundle-image
value: "$(steps.get-snapshot-images.results.bundle-image)"
- name: commit
value: "$(steps.get-snapshot-images.results.commit)"
params:
- name: SNAPSHOT
- name: namespace
type: string
volumes:
- name: credentials
emptyDir: {}
steps:
- name: get-snapshot-images
image: registry.redhat.io/openshift4/ose-cli:latest
env:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
results:
- name: bundle-image
type: string
description: "bundle image from snapshot"
- name: commit
type: string
description: "commit sha to be used in console tests"
script: |
dnf -y install jq
echo -n "$(jq -r --arg component_name "ols-bundle" '.components[] | select(.name == $component_name) | .containerImage' <<< "$SNAPSHOT")" > $(step.results.bundle-image.path)
echo -n "$(jq -r --arg component_name "ols-bundle" '.components[] | select(.name == $component_name) | .source.git.revision' <<< "$SNAPSHOT")" > $(step.results.commit.path)
- name: ols-e2e-tests
description: Task to run tests from service repository
runAfter:
- ols-install
params:
- name: commit
value: $(tasks.ols-install.results.commit)
- name: bundle-image
value: $(tasks.ols-install.results.bundle-image)
taskSpec:
volumes:
- name: openai-token
secret:
secretName: openai
- name: credentials
emptyDir: {}
- name: ols-konflux-artifacts-bot-creds
secret:
secretName: ols-konflux-artifacts-bot
params:
- name: commit
- name: bundle-image
steps:
- name: get-kubeconfig
ref:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/build-definitions.git
- name: revision
value: main
- name: pathInRepo
value: stepactions/eaas-get-ephemeral-cluster-credentials/0.1/eaas-get-ephemeral-cluster-credentials.yaml
params:
- name: eaasSpaceSecretRef
value: $(tasks.eaas-provision-space.results.secretRef)
- name: clusterName
value: "$(tasks.provision-cluster.results.clusterName)"
- name: credentials
value: credentials
- name: run-e2e-tests
resources:
requests:
cpu: '1'
memory: 1Gi
limits:
memory: 10Gi
onError: continue
volumeMounts:
- name: openai-token
mountPath: /var/run/openai
- name: credentials
mountPath: /credentials
env:
- name: CYPRESS_KUBECONFIG_PATH
value: "/credentials/$(steps.get-kubeconfig.results.kubeconfig)"
- name: CYPRESS_LOGIN_IDP
value: "kube:admin"
- name: LLM_TOKEN_PATH
value: "/var/run/openai/token"
- name: COMMIT_SHA
value: "$(params.commit)"
- name: PASSWORD_PATH
value: "/credentials/$(steps.get-kubeconfig.results.passwordPath)"
- name: CYPRESS_BASE_URL
value: "$(steps.get-kubeconfig.results.consoleURL)"
- name: BUNDLE_COMMIT_SHA
value: "$(params.commit)"
- name: CYPRESS_BUNDLE_IMAGE
value: "$(params.bundle-image)"
image: cypress/browsers:24.13.0
script: |
apt update && apt install -y jq
echo "COMMIT_SHA: ${COMMIT_SHA}"
echo "CYPRESS_BASE_URL: ${CYPRESS_BASE_URL}"
echo "CYPRESS_CONSOLE_IMAGE: ${CYPRESS_CONSOLE_IMAGE}"
echo "CYPRESS_KUBECONFIG_PATH: ${CYPRESS_KUBECONFIG_PATH}"
echo "---------------------------------------------"
cat "${CYPRESS_KUBECONFIG_PATH}"
echo "---------------------------------------------"
export CYPRESS_LOGIN_PASSWORD=$(cat ${PASSWORD_PATH})
echo "${CYPRESS_LOGIN_PASSWORD}"
echo "---------------------------------------------"
echo "---------------------------------------------"
wget --no-verbose -O oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest/openshift-client-linux.tar.gz \
&& tar -xvzf oc.tar.gz \
&& chmod +x kubectl oc \
&& mv oc kubectl /usr/local/bin/
echo "---------------------------------------------"
export OPERATOR_SDK_VERSION=1.36.1
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}
wget --no-verbose -O /usr/local/bin/operator-sdk ${OPERATOR_SDK_DL_URL}/operator-sdk_linux_${ARCH}
chmod +x /usr/local/bin/operator-sdk
echo "---------------------------------------------"
operator-sdk version
echo "---------------------------------------------"
mkdir -pv ~/.cache/xdgr
export XDG_RUNTIME_DIR=$PATH:~/.cache/xdgr
echo "---------------------------------------------"
cd /home
git clone https://github.com/openshift/lightspeed-console.git
cd lightspeed-console
git fetch origin
git switch pattern-fly-5
echo "---------------------------------------------"
echo "npm version: $(npm -v)"
echo "---------------------------------------------"
NODE_OPTIONS=--max-old-space-size=4096 npm ci --omit=optional --no-fund
echo "---------------------------------------------"
export CYPRESS_LOGIN_PASSWORD=$(cat ${PASSWORD_PATH})
set +e
NO_COLOR=1 npx cypress run
err_status=$?
echo -n "${err_status}" > /workspace/cypress-exit-code
echo "---------------------------------------------"
ls ./gui_test_screenshots
mv ./gui_test_screenshots /workspace/artifacts/
set -e
echo "Cypress exit code: ${err_status}"
exit ${err_status}
echo "---------------------------------------------"
- name: gather-cluster-resources
onError: continue
ref:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/tekton-integration-catalog
- name: revision
value: main
- name: pathInRepo
value: stepactions/gather-cluster-resources/0.1/gather-cluster-resources.yaml
params:
- name: credentials
value: "credentials"
- name: kubeconfig
value: "$(steps.get-kubeconfig.results.kubeconfig)"
- name: artifact-dir
value: "/workspace/artifacts/konflux-artifacts"
# validate that the cluster resources are available in another tekton step
- name: list-artifacts
onError: continue
image: quay.io/konflux-qe-incubator/konflux-qe-tools:latest
workingDir: "/workspace/"
script: |
#!/bin/bash
ls -la /workspace/
ls -la /workspace/artifacts/
ls -la /workspace/artifacts/gui_test_screenshots
- name: push-artifacts
onError: continue
ref:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/tekton-integration-catalog.git
- name: revision
value: main
- name: pathInRepo
value: stepactions/secure-push-oci/0.1/secure-push-oci.yaml
params:
- name: workdir-path
value: "/workspace/artifacts"
- name: oci-ref
value: "quay.io/openshift-lightspeed/ols-console-artifacts:$(params.commit)"
- name: credentials-volume-name
value: ols-konflux-artifacts-bot-creds
- name: fail-if-any-step-failed
ref:
resolver: git
params:
- name: url
value: https://github.com/konflux-ci/tekton-integration-catalog.git
- name: revision
value: main
- name: pathInRepo
value: stepactions/fail-if-any-step-failed/0.1/fail-if-any-step-failed.yaml