Skip to content

Commit a98fcb3

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 a98fcb3

File tree

1 file changed

+83
-2
lines changed

1 file changed

+83
-2
lines changed

pipelines/konflux-e2e-tests.yaml

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -146,6 +146,8 @@ spec:
146146
- bundle
147147
- --namespace
148148
- "$(params.namespace)"
149+
- --timeout
150+
- "10m0s"
149151
- "$(params.bundleImage)"
150152
- name: e2e-test
151153
description: Placeholder task that prints the Snapshot and outputs standard TEST_OUTPUT
@@ -195,4 +197,83 @@ spec:
195197
#!/usr/bin/env bash
196198
set -ex -u -o pipefail
197199
198-
oc get all -n openshift-builds
200+
NAMESPACE="default" # using default since openshift-builds NS is not available
201+
DEPLOYMENTS=("openshift-builds-operator" "openshift-pipelines-operator" "shipwright-build-controller" "shipwright-build-webhook" "tekton-operator-webhook")
202+
BUILDS=("buildah-golang-buildrun")
203+
204+
oc get all -n $NAMESPACE
205+
# sleep for 5 minutes, give deployments time to get ready
206+
sleep 300
207+
oc get all -n $NAMESPACE
208+
for DEPLOYMENT in "${DEPLOYMENTS[@]}"; do
209+
oc wait deployment "$DEPLOYMENT" --namespace="$NAMESPACE" --for="condition=available" --timeout="180s"
210+
done
211+
212+
echo "All specified deployments are running and ready."
213+
214+
# Check running builds
215+
oc apply -f - <<EOF
216+
apiVersion: shipwright.io/v1beta1
217+
kind: Build
218+
metadata:
219+
name: buildah-golang-build
220+
spec:
221+
source:
222+
type: Git
223+
git:
224+
url: https://github.com/redhat-openshift-builds/samples
225+
contextDir: buildah-build
226+
strategy:
227+
name: buildah
228+
kind: ClusterBuildStrategy
229+
paramValues:
230+
- name: dockerfile
231+
value: Dockerfile
232+
output:
233+
image: ttl.sh/build-examples-golang:30m
234+
EOF
235+
236+
oc apply -f - <<EOF
237+
apiVersion: shipwright.io/v1beta1
238+
kind: BuildRun
239+
metadata:
240+
name: buildah-golang-buildrun
241+
spec:
242+
build:
243+
name: buildah-golang-build
244+
EOF
245+
246+
# Wait for builds to succeed (with a 10-minute timeout)
247+
TIMEOUT=600 # 10 minutes
248+
INTERVAL=30 # Check every 30 seconds
249+
250+
for BUILD in "${BUILDS[@]}"; do
251+
START_TIME=$(date +%s)
252+
253+
while true; do
254+
CURRENT_TIME=$(date +%s)
255+
ELAPSED=$((CURRENT_TIME - START_TIME))
256+
257+
if [[ $ELAPSED -ge $TIMEOUT ]]; then
258+
echo "Timeout waiting for build $BUILD. Exiting..."
259+
exit 1
260+
fi
261+
262+
STATUS=$(kubectl get buildrun "$BUILD" -n "$NAMESPACE" -o jsonpath="{.status.conditions[?(@.type=='Succeeded')].status}" 2>/dev/null || echo "Unknown")
263+
264+
if [[ "$STATUS" == "True" ]]; then
265+
echo "Build $BUILD succeeded!"
266+
break
267+
elif [[ "$STATUS" == "False" ]]; then
268+
echo "Build $BUILD failed!"
269+
exit 1
270+
else
271+
echo "Waiting for build $BUILD to complete... ($ELAPSED/$TIMEOUT seconds)"
272+
sleep $INTERVAL
273+
fi
274+
done
275+
done
276+
277+
echo "All builds completed successfully."
278+
279+

0 commit comments

Comments
 (0)