From 71b29a1cd384c957e220c4d05a1c37f99921864f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arda=20G=C3=BC=C3=A7l=C3=BC?= Date: Tue, 11 Jan 2022 09:57:17 +0300 Subject: [PATCH] Create ImageContentSourcePolicy for disconnected upgrade In disconnected upgrades, namely e2e-metal-ipi-upgrade-ovn-ipv6, release image is mirrored to be used, however since ImageContentSourcePolicy is not created, pods get image pull errors and upgrade fails in presubmit jobs. Upgrade passes in periodics because from and to releases use same registry. This PR adds ImageContentSourcePolicy. --- .../e2e/test/baremetalds-e2e-test-commands.sh | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ci-operator/step-registry/baremetalds/e2e/test/baremetalds-e2e-test-commands.sh b/ci-operator/step-registry/baremetalds/e2e/test/baremetalds-e2e-test-commands.sh index 79af92ae0e6ad..7afbfc92a3ad0 100644 --- a/ci-operator/step-registry/baremetalds/e2e/test/baremetalds-e2e-test-commands.sh +++ b/ci-operator/step-registry/baremetalds/e2e/test/baremetalds-e2e-test-commands.sh @@ -45,17 +45,30 @@ function mirror_release_image_for_disconnected_upgrade() { if [[ "${DS_IP_STACK}" == "v6" ]]; then # shellcheck disable=SC2087 ssh "${SSHOPTS[@]}" "root@${IP}" bash - << EOF -MIRRORED_RELEASE_IMAGE=${DS_REGISTRY}/localimages/local-release-image +MIRRORED_RELEASE_IMAGE=${DS_REGISTRY}/localimages/local-upgrade-image DIGEST=\$(oc adm release info --registry-config ${DS_WORKING_DIR}/pull_secret.json ${OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE} --output=jsonpath="{.digest}") +RELEASE_TAG=\$(sed -e "s/^sha256://" <<< \${DIGEST}) +MIRROR_RESULT_LOG=/tmp/image_mirror-\${RELEASE_TAG}.log + echo "Mirroring release images for disconnected environment" -oc adm release mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json --from=${OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE} --to=\${MIRRORED_RELEASE_IMAGE} --apply-release-image-signature -echo "OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE=\${MIRRORED_RELEASE_IMAGE}@\${DIGEST}" >> /tmp/disconnected_mirror.conf +oc adm release mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json \ + --from=${OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE} \ + --to=\${MIRRORED_RELEASE_IMAGE} \ + --to-release-image=\${MIRRORED_RELEASE_IMAGE}:\${RELEASE_TAG} 2>&1 | tee \${MIRROR_RESULT_LOG} + +echo "Create ImageContentSourcePolicy to use mirrored registry in upgrade" +UPGRADE_ICS=\$(cat \${MIRROR_RESULT_LOG} | sed -n '/repositoryDigestMirrors/,//p') + +cat <