Skip to content

Commit 0c55d2c

Browse files
committed
feat: add integration test config
- this commit adds infrastructure configuration for running e2e tests on konflux Signed-off-by: Avinal Kumar <[email protected]>
1 parent 2f5ddfd commit 0c55d2c

File tree

1 file changed

+117
-3
lines changed

1 file changed

+117
-3
lines changed

pipelines/konflux-e2e-tests.yaml

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: tekton.dev/v1
33
kind: Pipeline
44
metadata:
5-
name: builds-e2e-tests
5+
name: e2e-openshift-builds
66
spec:
77
description: |
88
An integration test which provisions an ephemeral Hypershift cluster and deploys an Operator
@@ -14,7 +14,7 @@ spec:
1414
type: string
1515
- description: Namespace where the the Operator bundle will be deployed.
1616
name: NAMESPACE
17-
default: openshift-builds
17+
default: default
1818
type: string
1919
tasks:
2020
- name: parse-metadata
@@ -98,6 +98,39 @@ spec:
9898
value: "$(steps.pick-version.results.version)"
9999
- name: instanceType
100100
value: m5.2xlarge
101+
- name: imageContentSources
102+
value: |
103+
- source: registry.redhat.io/openshift-builds/openshift-builds-rhel9-operator
104+
mirrors:
105+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-operator
106+
- source: registry.redhat.io/openshift-builds/openshift-builds-operator-bundle
107+
mirrors:
108+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-operator-bundle
109+
- source: registry.redhat.io/openshift-builds/openshift-builds-controller-rhel9
110+
mirrors:
111+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-controller
112+
- source: registry.redhat.io/openshift-builds/openshift-builds-image-processing-rhel9
113+
mirrors:
114+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-image-processing
115+
- source: registry.redhat.io/openshift-builds/openshift-builds-image-bundler-rhel9
116+
mirrors:
117+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-image-bundler
118+
- source: registry.redhat.io/openshift-builds/openshift-builds-git-cloner-rhel9
119+
mirrors:
120+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-git-cloner
121+
- source: registry.redhat.io/openshift-builds/openshift-builds-waiters-rhel9
122+
mirrors:
123+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-waiter
124+
- source: registry.redhat.io/openshift-builds/openshift-builds-webhook-rhel9
125+
mirrors:
126+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-webhook
127+
- source: registry.redhat.io/openshift-builds/openshift-builds-shared-resource-rhel9
128+
mirrors:
129+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-shared-resource
130+
- source: registry.redhat.io/openshift-builds/openshift-builds-shared-resource-webhook-rhel9
131+
mirrors:
132+
- quay.io/redhat-user-workloads/rh-openshift-builds-tenant/openshift-builds-shared-resource-webhook
133+
101134
- name: deploy-operator
102135
runAfter:
103136
- provision-cluster
@@ -146,6 +179,8 @@ spec:
146179
- bundle
147180
- --namespace
148181
- "$(params.namespace)"
182+
- --timeout
183+
- "10m0s"
149184
- "$(params.bundleImage)"
150185
- name: e2e-test
151186
description: Placeholder task that prints the Snapshot and outputs standard TEST_OUTPUT
@@ -194,5 +229,84 @@ spec:
194229
script: |
195230
#!/usr/bin/env bash
196231
set -ex -u -o pipefail
232+
233+
# TODO: remove this hack for getting cluster credentials for debugging
234+
cat /credentials/cluster-*-password
197235
198-
oc get all -n openshift-builds
236+
NAMESPACE="default" # using default since openshift-builds NS is not available
237+
DEPLOYMENTS=("openshift-builds-operator" "openshift-pipelines-operator" "shipwright-build-controller" "shipwright-build-webhook" "tekton-operator-webhook" "shared-resource-csi-driver-webhook")
238+
BUILDS=("buildah-golang-buildrun")
239+
240+
oc get all -n $NAMESPACE
241+
for DEPLOYMENT in "${DEPLOYMENTS[@]}"; do
242+
oc wait deployment "$DEPLOYMENT" --namespace="$NAMESPACE" --for="condition=available" --timeout="180s"
243+
done
244+
245+
echo "All specified deployments are running and ready."
246+
247+
# Check running builds
248+
oc apply -f - <<EOF
249+
apiVersion: shipwright.io/v1beta1
250+
kind: Build
251+
metadata:
252+
name: buildah-golang-build
253+
spec:
254+
source:
255+
type: Git
256+
git:
257+
url: https://github.com/redhat-openshift-builds/samples
258+
contextDir: buildah-build
259+
strategy:
260+
name: buildah
261+
kind: ClusterBuildStrategy
262+
paramValues:
263+
- name: dockerfile
264+
value: Dockerfile
265+
output:
266+
image: ttl.sh/build-examples-golang:30m
267+
EOF
268+
269+
oc apply -f - <<EOF
270+
apiVersion: shipwright.io/v1beta1
271+
kind: BuildRun
272+
metadata:
273+
name: buildah-golang-buildrun
274+
spec:
275+
build:
276+
name: buildah-golang-build
277+
EOF
278+
279+
# Wait for builds to succeed (with a 10-minute timeout)
280+
TIMEOUT=600 # 10 minutes
281+
INTERVAL=30 # Check every 30 seconds
282+
283+
for BUILD in "${BUILDS[@]}"; do
284+
START_TIME=$(date +%s)
285+
286+
while true; do
287+
CURRENT_TIME=$(date +%s)
288+
ELAPSED=$((CURRENT_TIME - START_TIME))
289+
290+
if [[ $ELAPSED -ge $TIMEOUT ]]; then
291+
echo "Timeout waiting for build $BUILD. Exiting..."
292+
exit 1
293+
fi
294+
295+
STATUS=$(kubectl get buildrun "$BUILD" -n "$NAMESPACE" -o jsonpath="{.status.conditions[?(@.type=='Succeeded')].status}" 2>/dev/null || echo "Unknown")
296+
297+
if [[ "$STATUS" == "True" ]]; then
298+
echo "Build $BUILD succeeded!"
299+
break
300+
elif [[ "$STATUS" == "False" ]]; then
301+
echo "Build $BUILD failed!"
302+
exit 1
303+
else
304+
echo "Waiting for build $BUILD to complete... ($ELAPSED/$TIMEOUT seconds)"
305+
sleep $INTERVAL
306+
fi
307+
done
308+
done
309+
310+
echo "All builds completed successfully."
311+
312+

0 commit comments

Comments
 (0)