Skip to content

Commit b20e474

Browse files
authored
Merge pull request #555 from application-stacks/version-check
Check correct operator version is installed at the acceptance test stage
2 parents 405e42e + a853db5 commit b20e474

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ test-pipeline-e2e:
353353
--registry-name "${PIPELINE_REGISTRY}" --registry-image "${PIPELINE_OPERATOR_IMAGE}" \
354354
--registry-user "${PIPELINE_USERNAME}" --registry-password "${PIPELINE_PASSWORD}" \
355355
--test-tag "${TRAVIS_BUILD_NUMBER}" --release "${RELEASE_TARGET}" --channel "${DEFAULT_CHANNEL}" \
356-
--install-mode "${INSTALL_MODE}" --architecture "${ARCHITECTURE}"
356+
--install-mode "${INSTALL_MODE}" --architecture "${ARCHITECTURE}" \
357+
--digest "${DIGEST}" --version "${VERSION}"
357358

358359
bundle-build-podman:
359360
podman build -f bundle.Dockerfile -t "${BUNDLE_IMG}"

scripts/acceptance-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ declare -A E2E_TESTS=(
2828
--env DEBUG_FAILURE=${DEBUG_FAILURE} \
2929
--env INSTALL_MODE=${INSTALL_MODE} \
3030
--env ARCHITECTURE=${ARCHITECTURE} \
31+
--env DIGEST=${DIGEST} \
3132
e2e-runner:latest \
3233
make test-pipeline-e2e
3334
EOF

scripts/pipeline/ocp-cluster-e2e.sh

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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>"
44
readonly OC_CLIENT_VERSION="latest-4.10"
55
readonly 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:
285310
EOF
286311
fi
287312

288-
echo "****** Applying the subscription..."
313+
echo "****** Applying the subscription for version: ${VERSION}"
289314
cat <<EOF | oc apply -f -
290315
apiVersion: operators.coreos.com/v1alpha1
291316
kind: Subscription
@@ -298,6 +323,7 @@ spec:
298323
source: runtime-component-catalog
299324
sourceNamespace: openshift-marketplace
300325
installPlanApproval: Automatic
326+
startingCSV: runtime-component.v${VERSION}
301327
EOF
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"

scripts/pipeline/runTest.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ export FYRE_KEY=$(get_env fyre-key)
4444
export FYRE_PASS=$(get_env fyre-pass)
4545
export FYRE_PRODUCT_GROUP_ID=$(get_env fyre-product-group-id)
4646

47+
echo "${PIPELINE_PASSWORD}" | docker login "${PIPELINE_REGISTRY}" -u "${PIPELINE_USERNAME}" --password-stdin
48+
IMAGE="${PIPELINE_REGISTRY}/${PIPELINE_OPERATOR_IMAGE}:${RELEASE_TARGET}"
49+
echo "one-pipline Image value: ${IMAGE}"
50+
DIGEST="$(skopeo inspect docker://$IMAGE | grep Digest | grep -o 'sha[^\"]*')"
51+
52+
export DIGEST
53+
echo "one-pipeline Digest Value: ${DIGEST}"
54+
4755
cd ../..
4856
echo "directory before acceptance-test.sh"
4957
pwd

0 commit comments

Comments
 (0)