11#! /bin/bash
22
3- readonly usage=" Usage: ocp-cluster-e2e.sh -u <docker-username> -p <docker-password> --cluster-url <url> --cluster-token <token> --registry-name <name> --registry-image <ns/image> --registry-user <user> --registry-password <password> --release <daily|release-tag> --test-tag <test-id> --catalog-image <catalog-image> --channel <channel>"
3+ readonly usage=" Usage: ocp-cluster-e2e.sh -u <docker-username> -p <docker-password> --cluster-url <url> --cluster-token <token> --registry-name <name> --registry-image <ns/image> --registry-user <user> --registry-password <password> --release <daily|release-tag> --test-tag <test-id> --catalog-image <catalog-image> --channel <channel> --architecture <architecture> --digest <digest> --version <version> "
44readonly OC_CLIENT_VERSION=" latest-4.10"
55readonly CONTROLLER_MANAGER_NAME=" rco-controller-manager"
66
@@ -174,6 +174,18 @@ main() {
174174 exit 1
175175 fi
176176
177+ if [[ -z " ${DIGEST} " ]]; then
178+ echo " ****** Missing digest, see usage"
179+ echo " ${usage} "
180+ exit 1
181+ fi
182+
183+ if [[ -z " ${VERSION} " ]]; then
184+ echo " ****** Missing version, see usage"
185+ echo " ${usage} "
186+ exit 1
187+ fi
188+
177189 echo " ****** Setting up test environment..."
178190 setup_env
179191
@@ -229,6 +241,19 @@ main() {
229241 sleep 10
230242 done
231243
244+ # Check correct version of the operator has been installed
245+ img_digest=" icr.io/appcafe/runtime-component-operator@${DIGEST} "
246+ echo " Expect operator image version: ${img_digest} "
247+ pod=$( oc get pods -n " ${TEST_NAMESPACE} " | awk ' {print $1}' | grep rco-controller-manager)
248+ install_img=" $( oc get pod -n " ${TEST_NAMESPACE} " ${pod} -o jsonpath={.spec.containers..image}) "
249+ echo " Actual installed operation image version: ${install_img} "
250+ if [[ " ${install_img} " != " ${img_digest} " ]]; then
251+ echo " Install Operator image ${install_img} does not match correct image ${img_digest} "
252+ exit 1
253+ else
254+ echo " Correct Operator image running"
255+ fi
256+
232257 echo " ****** ${CONTROLLER_MANAGER_NAME} deployment is ready..."
233258
234259 if [[ " $ARCHITECTURE " != " Z" ]]; then
@@ -285,7 +310,7 @@ spec:
285310EOF
286311fi
287312
288- echo " ****** Applying the subscription... "
313+ echo " ****** Applying the subscription for version: ${VERSION} "
289314 cat << EOF | oc apply -f -
290315apiVersion: operators.coreos.com/v1alpha1
291316kind: Subscription
@@ -298,6 +323,7 @@ spec:
298323 source: runtime-component-catalog
299324 sourceNamespace: openshift-marketplace
300325 installPlanApproval: Automatic
326+ startingCSV: runtime-component.v${VERSION}
301327EOF
302328}
303329
@@ -398,6 +424,14 @@ parse_args() {
398424 shift
399425 readonly ARCHITECTURE=" ${1} "
400426 ;;
427+ --digest)
428+ shift
429+ readonly DIGEST=" ${1} "
430+ ;;
431+ --version)
432+ shift
433+ readonly VERSION=" ${1} "
434+ ;;
401435 * )
402436 echo " Error: Invalid argument - $1 "
403437 echo " $usage "
0 commit comments