Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF1 | oc apply -f -
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
name: disconnected-upgrade-ics
spec:
\${UPGRADE_ICS}
EOF1
EOF

# shellcheck source=/dev/null
source <(ssh "${SSHOPTS[@]}" "root@${IP}" "cat /tmp/disconnected_mirror.conf")
echo "OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE is overridden to ${OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep this echo? I guess it would be useful when troubleshooting

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not overriding image anymore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using actual image as upgrade and it is automatically mirrored to our registry via ImageContentSourcePolicy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the canonical env var name used for injecting the release:latest pullspec and still used:

oc adm release mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json \
 --from=${OPENSHIFT_UPGRADE_RELEASE_IMAGE_OVERRIDE} \

The echo will be just a tip in the log to specify to which version we're currently upgrading to

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But since we are not overriding, it is in;

openshift-tests run-upgrade all --to-image registry.build03.ci.openshift.org/ci-op-3g123y5y/release@sha256:5d19aec75540e8056cca0ab3ab1ee9c4098c0a703b1264ded57a477cae0c496e --provider '{"type":"baremetal","disconnected":true}' --from-repository virthost.ostest.test.metalkube.org:5000/localimages/local-test-image -o /logs/artifacts/e2e.log --junit-dir /logs/artifacts/junit

https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift_release/25130/rehearse-25130-pull-ci-openshift-cluster-baremetal-operator-master-e2e-metal-ipi-upgrade-ovn-ipv6-trigger/1481247658726133760/artifacts/e2e-metal-ipi-upgrade-ovn-ipv6-trigger/baremetalds-e2e-test/build-log.txt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the var name it's a bit unfortunate, anyhow I noticed that the info I was really looking for is also reported in a better way later, ie:

"desired": {
      "version": "4.10.0-0.ci.test-2022-01-12-125752-ci-op-3g123y5y-latest",
      "image": "registry.build03.ci.openshift.org/ci-op-3g123y5y/release@sha256:5d19aec75540e8056cca0ab3ab1ee9c4098c0a703b1264ded57a477cae0c496e"
    }


TEST_UPGRADE_ARGS="--from-repository ${DS_REGISTRY}/localimages/local-test-image"
fi
}
Expand Down