Skip to content

Commit 74d609f

Browse files
Merge pull request #1472 from JoaoFula/test-multiple-configs
OLS-2670 - Adding multiple configuration test
2 parents eecf780 + fe41841 commit 74d609f

8 files changed

Lines changed: 1791 additions & 72 deletions

File tree

Lines changed: 334 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
---
2+
apiVersion: tekton.dev/v1beta1
3+
kind: Pipeline
4+
metadata:
5+
annotations:
6+
pipelinesascode.tekton.dev/task: "[ols-installer, ols-e2e-task]"
7+
name: ols-integration-tests-pipeline
8+
spec:
9+
description: |
10+
This pipeline automates the process of running end-to-end tests for OpenShift Lightspeed
11+
using a ROSA (Red Hat OpenShift Service on AWS) cluster. The pipeline provisions
12+
the ROSA cluster, installs the OpenShift Lightspeed operator using the installer, runs the tests, collects artifacts,
13+
and finally deprovisions the ROSA cluster.
14+
params:
15+
- name: SNAPSHOT
16+
description: 'The JSON string representing the snapshot of the application under test.'
17+
default: '{"components": [{"name":"test-app", "containerImage": "quay.io/example/repo:latest"}]}'
18+
type: string
19+
- name: test-name
20+
description: 'The name of the test corresponding to a defined Konflux integration test.'
21+
default: 'ols-e2e-test-all-features'
22+
- name: namespace
23+
description: 'Namespace to run tests in'
24+
default: 'openshift-lightspeed'
25+
tasks:
26+
- name: eaas-provision-space
27+
taskRef:
28+
resolver: git
29+
params:
30+
- name: url
31+
value: https://github.com/konflux-ci/build-definitions.git
32+
- name: revision
33+
value: main
34+
- name: pathInRepo
35+
value: task/eaas-provision-space/0.1/eaas-provision-space.yaml
36+
params:
37+
- name: ownerKind
38+
value: PipelineRun
39+
- name: ownerName
40+
value: $(context.pipelineRun.name)
41+
- name: ownerUid
42+
value: $(context.pipelineRun.uid)
43+
- name: provision-cluster
44+
runAfter:
45+
- eaas-provision-space
46+
taskSpec:
47+
results:
48+
- name: clusterName
49+
value: "$(steps.create-cluster.results.clusterName)"
50+
steps:
51+
- name: pick-version
52+
ref:
53+
resolver: git
54+
params:
55+
- name: url
56+
value: https://github.com/konflux-ci/build-definitions.git
57+
- name: revision
58+
value: main
59+
- name: pathInRepo
60+
value: stepactions/eaas-get-latest-openshift-version-by-prefix/0.1/eaas-get-latest-openshift-version-by-prefix.yaml
61+
params:
62+
- name: prefix
63+
value: "4.19."
64+
- name: create-cluster
65+
ref:
66+
resolver: git
67+
params:
68+
- name: url
69+
value: https://github.com/konflux-ci/build-definitions.git
70+
- name: revision
71+
value: main
72+
- name: pathInRepo
73+
value: stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml
74+
params:
75+
- name: eaasSpaceSecretRef
76+
value: $(tasks.eaas-provision-space.results.secretRef)
77+
- name: version
78+
value: "$(steps.pick-version.results.version)"
79+
- name: instanceType
80+
value: "m5.large"
81+
- name: ols-install
82+
description: Task to install bundle onto ephemeral namespace
83+
runAfter:
84+
- provision-cluster
85+
params:
86+
- name: SNAPSHOT
87+
value: $(params.SNAPSHOT)
88+
- name: namespace
89+
value: "$(params.namespace)"
90+
taskSpec:
91+
results:
92+
- name: bundle-image
93+
value: "$(steps.get-bundle-image.results.bundle-image)"
94+
- name: commit
95+
value: "$(steps.get-bundle-image.results.commit)"
96+
params:
97+
- name: SNAPSHOT
98+
- name: namespace
99+
type: string
100+
volumes:
101+
- name: credentials
102+
emptyDir: {}
103+
steps:
104+
- name: get-kubeconfig
105+
ref:
106+
resolver: git
107+
params:
108+
- name: url
109+
value: https://github.com/konflux-ci/build-definitions.git
110+
- name: revision
111+
value: main
112+
- name: pathInRepo
113+
value: stepactions/eaas-get-ephemeral-cluster-credentials/0.1/eaas-get-ephemeral-cluster-credentials.yaml
114+
params:
115+
- name: eaasSpaceSecretRef
116+
value: $(tasks.eaas-provision-space.results.secretRef)
117+
- name: clusterName
118+
value: "$(tasks.provision-cluster.results.clusterName)"
119+
- name: credentials
120+
value: credentials
121+
- name: install-operator
122+
env:
123+
- name: SNAPSHOT
124+
value: $(params.SNAPSHOT)
125+
- name: KONFLUX_COMPONENT_NAME
126+
valueFrom:
127+
fieldRef:
128+
fieldPath: metadata.labels['appstudio.openshift.io/component']
129+
- name: KUBECONFIG
130+
value: "/credentials/$(steps.get-kubeconfig.results.kubeconfig)"
131+
volumeMounts:
132+
- name: credentials
133+
mountPath: /credentials
134+
image: registry.redhat.io/openshift4/ose-cli:latest
135+
script: |
136+
echo "---------------------------------------------"
137+
cat $KUBECONFIG
138+
echo "---------------------------------------------"
139+
dnf -y install jq python3-pip
140+
export OPERATOR_SDK_VERSION=1.36.1
141+
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
142+
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}
143+
curl -Lo /usr/local/bin/operator-sdk ${OPERATOR_SDK_DL_URL}/operator-sdk_linux_${ARCH}
144+
chmod +x /usr/local/bin/operator-sdk
145+
operator-sdk version
146+
echo "---------------------------------------------"
147+
oc create namespace $(params.namespace)
148+
oc label namespaces $(params.namespace) openshift.io/cluster-monitoring=true --overwrite=true
149+
echo "---------------------------------------------"
150+
echo ${KONFLUX_COMPONENT_NAME}
151+
export BUNDLE_IMAGE="$(jq -r --arg component_name "$KONFLUX_COMPONENT_NAME" '.components[] | select(.name == $component_name) | .containerImage' <<< "$SNAPSHOT")"
152+
echo "${BUNDLE_IMAGE}"
153+
echo "---------------------------------------------"
154+
operator-sdk run bundle --timeout=30m --namespace "$(params.namespace)" "$BUNDLE_IMAGE" --verbose
155+
echo "---------------------------------------------"
156+
oc get deployment lightspeed-operator-controller-manager -n "$(params.namespace)"
157+
- name: get-bundle-image
158+
image: registry.redhat.io/openshift4/ose-cli:latest
159+
env:
160+
- name: SNAPSHOT
161+
value: $(params.SNAPSHOT)
162+
results:
163+
- name: bundle-image
164+
type: string
165+
description: "service image from snapshot"
166+
- name: commit
167+
type: string
168+
description: "commit sha to be used to store artifacts"
169+
script: |
170+
dnf -y install jq
171+
echo -n "$(jq -r --arg component_name "ols-bundle" '.components[] | select(.name == $component_name) | .containerImage' <<< "$SNAPSHOT")" > $(step.results.bundle-image.path)
172+
echo -n "$(jq -r --arg component_name "ols-bundle" '.components[] | select(.name == $component_name) | .source.git.revision' <<< "$SNAPSHOT")" > $(step.results.commit.path)
173+
- name: ols-operator-tests
174+
description: Task to run tests from operator repository
175+
params:
176+
- name: commit
177+
value: $(tasks.ols-install.results.commit)
178+
runAfter:
179+
- ols-install
180+
taskSpec:
181+
params:
182+
- name: commit
183+
volumes:
184+
- name: azure-openai-token
185+
secret:
186+
secretName: azureopenai-apitoken
187+
- name: azureopenai-entra-id
188+
secret:
189+
secretName: azureopenai-entra-id
190+
- name: bam-token
191+
secret:
192+
secretName: bam-apitoken
193+
- name: openai-token
194+
secret:
195+
secretName: openai
196+
- name: watsonx-token
197+
secret:
198+
secretName: watsonx-apitoken
199+
- name: credentials
200+
emptyDir: {}
201+
- name: ols-konflux-artifacts-bot-creds
202+
secret:
203+
secretName: ols-konflux-artifacts-bot
204+
steps:
205+
- name: get-kubeconfig
206+
ref:
207+
resolver: git
208+
params:
209+
- name: url
210+
value: https://github.com/konflux-ci/build-definitions.git
211+
- name: revision
212+
value: main
213+
- name: pathInRepo
214+
value: stepactions/eaas-get-ephemeral-cluster-credentials/0.1/eaas-get-ephemeral-cluster-credentials.yaml
215+
params:
216+
- name: eaasSpaceSecretRef
217+
value: $(tasks.eaas-provision-space.results.secretRef)
218+
- name: clusterName
219+
value: "$(tasks.provision-cluster.results.clusterName)"
220+
- name: credentials
221+
value: credentials
222+
- name: run-e2e-tests
223+
resources:
224+
requests:
225+
memory: "8Gi"
226+
limits:
227+
memory: "8Gi"
228+
onError: continue
229+
volumeMounts:
230+
- name: azure-openai-token
231+
mountPath: /var/run/azure_openai
232+
- name: azureopenai-entra-id
233+
mountPath: /var/run/azureopenai-entra-id
234+
- name: bam-token
235+
mountPath: /var/run/bam
236+
- name: openai-token
237+
mountPath: /var/run/openai
238+
- name: watsonx-token
239+
mountPath: /var/run/watsonx
240+
- name: credentials
241+
mountPath: /credentials
242+
env:
243+
- name: KUBECONFIG
244+
value: "/credentials/$(steps.get-kubeconfig.results.kubeconfig)"
245+
- name: BAM_PROVIDER_KEY_PATH
246+
value: "/var/run/bam/token"
247+
- name: AZUREOPENAI_PROVIDER_KEY_PATH
248+
value: "/var/run/azure_openai/token"
249+
- name: OPENAI_PROVIDER_KEY_PATH
250+
value: "/var/run/openai/token"
251+
- name: WATSONX_PROVIDER_KEY_PATH
252+
value: "/var/run/watsonx/token"
253+
- name: COMMIT_SHA
254+
value: "$(params.commit)"
255+
- name: ARTIFACT_DIR
256+
value: "/workspace"
257+
image: registry.redhat.io/openshift4/ose-cli:latest
258+
script: |
259+
echo "---------------------------------------------"
260+
cat $KUBECONFIG
261+
echo "---------------------------------------------"
262+
dnf -y install git make golang jq gpgme-devel
263+
git init lightspeed-operator
264+
cd lightspeed-operator
265+
git remote add origin https://github.com/openshift/lightspeed-operator.git
266+
git fetch --depth=1 --filter=blob:none origin ${COMMIT_SHA}
267+
TEST_SOURCE_COMMIT=$(
268+
git show ${COMMIT_SHA}:related_images.json |
269+
jq -r '.[] | select(.name=="lightspeed-operator") | .revision'
270+
)
271+
git fetch --depth=1 --filter=blob:none origin ${TEST_SOURCE_COMMIT}
272+
git checkout ${TEST_SOURCE_COMMIT}
273+
echo "---------------------------------------------"
274+
echo "---------------------------------------------"
275+
echo "---------------------------------------------"
276+
export LLM_TOKEN=$(cat ${OPENAI_PROVIDER_KEY_PATH})
277+
export LLM_PROVIDER="openai"
278+
export LLM_MODEL="gpt-4o-mini"
279+
echo "starting tests for $LLM_PROVIDER $LLM_MODEL"
280+
make test-e2e-all-features
281+
- name: gather-cluster-resources
282+
onError: continue
283+
ref:
284+
resolver: git
285+
params:
286+
- name: url
287+
value: https://github.com/konflux-ci/tekton-integration-catalog
288+
- name: revision
289+
value: main
290+
- name: pathInRepo
291+
value: stepactions/gather-cluster-resources/0.1/gather-cluster-resources.yaml
292+
params:
293+
- name: credentials
294+
value: "credentials"
295+
- name: kubeconfig
296+
value: "$(steps.get-kubeconfig.results.kubeconfig)"
297+
- name: artifact-dir
298+
value: "/workspace/konflux-artifacts"
299+
# validate that the cluster resources are available in another tekton step
300+
- name: list-artifacts
301+
onError: continue
302+
image: quay.io/konflux-qe-incubator/konflux-qe-tools:latest
303+
workingDir: "/workspace"
304+
script: |
305+
#!/bin/bash
306+
ls -la /workspace
307+
- name: push-artifacts
308+
onError: continue
309+
ref:
310+
resolver: git
311+
params:
312+
- name: url
313+
value: https://github.com/konflux-ci/tekton-integration-catalog.git
314+
- name: revision
315+
value: main
316+
- name: pathInRepo
317+
value: stepactions/secure-push-oci/0.1/secure-push-oci.yaml
318+
params:
319+
- name: workdir-path
320+
value: /workspace
321+
- name: oci-ref
322+
value: "quay.io/openshift-lightspeed/ols-operator-artifacts:$(params.commit)"
323+
- name: credentials-volume-name
324+
value: ols-konflux-artifacts-bot-creds
325+
- name: fail-if-any-step-failed
326+
ref:
327+
resolver: git
328+
params:
329+
- name: url
330+
value: https://github.com/konflux-ci/tekton-integration-catalog.git
331+
- name: revision
332+
value: main
333+
- name: pathInRepo
334+
value: stepactions/fail-if-any-step-failed/0.1/fail-if-any-step-failed.yaml

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ endif
178178
ifndef LLM_TOKEN
179179
$(error LLM_TOKEN environment variable is not set)
180180
endif
181-
go test -tags=exclude_graphdriver_btrfs ./test/e2e -timeout=120m -ginkgo.v -test.v -ginkgo.show-node-events --ginkgo.label-filter="!Rapidast && !Upgrade" --ginkgo.timeout=2h
181+
go test -tags=exclude_graphdriver_btrfs ./test/e2e -timeout=120m -ginkgo.v -test.v -ginkgo.show-node-events --ginkgo.label-filter="!Rapidast && !Upgrade && !AllFeatures" --ginkgo.timeout=2h
182182

183183
.PHONY: test-upgrade
184184
test-upgrade: ## Run upgrade tests with an Openshift cluster. Requires KUBECONFIG, LLM_TOKEN and BUNDLE_IMAGE environment variables.
@@ -193,6 +193,16 @@ ifndef BUNDLE_IMAGE
193193
endif
194194
go test ./test/e2e -timeout=120m -ginkgo.v -test.v -ginkgo.show-node-events --ginkgo.label-filter="Upgrade" --ginkgo.timeout=2h
195195

196+
.PHONY: test-e2e-all-features
197+
test-e2e-all-features: ## Run comprehensive all-features E2E test. Requires KUBECONFIG and LLM_TOKEN environment variables.
198+
ifndef KUBECONFIG
199+
$(error KUBECONFIG environment variable is not set)
200+
endif
201+
ifndef LLM_TOKEN
202+
$(error LLM_TOKEN environment variable is not set)
203+
endif
204+
go test -tags=exclude_graphdriver_btrfs ./test/e2e -timeout=180m -ginkgo.v -test.v -ginkgo.show-node-events --ginkgo.label-filter="AllFeatures" --ginkgo.timeout=3h
205+
196206
.PHONY: test-e2e-local
197207
test-e2e-local: ## Run e2e tests with an Openshift cluster, excluding Database-Persistency test that requires a storage class. Requires KUBECONFIG and LLM_TOKEN environment variables.
198208
ifndef KUBECONFIG

0 commit comments

Comments
 (0)