Skip to content
Closed
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
26 changes: 13 additions & 13 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -371,32 +371,32 @@ function generate_metal3_config {
ln -f clouds.yaml _clouds_yaml/clouds.yaml
}

function pullspec_registry {
PULLSPEC="${1}"
echo "${PULLSPEC%%/*}" # strip the first slash and everything after it
}

function image_mirror_config {
if [[ ! -z "${MIRROR_IMAGES}" || ! -z "${ENABLE_LOCAL_REGISTRY}" ]]; then
INDENTED_CERT=$( cat $REGISTRY_DIR/certs/$REGISTRY_CRT | awk '{ print " ", $0 }' )
if [[ ! -z "${MIRROR_IMAGES}" && ! -s ${MIRROR_LOG_FILE} ]]; then
. /tmp/mirrored_release_image
TAGGED=$(echo $MIRRORED_RELEASE_IMAGE | sed -e 's/release://')
RELEASE=$(echo $MIRRORED_RELEASE_IMAGE | grep -o 'registry.ci.openshift.org[^":\@]\+')
cat << EOF
imageContentSources:
- mirrors:
- ${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/localimages/local-release-image
source: ${RELEASE}
- mirrors:
- ${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/localimages/local-release-image
source: ${TAGGED}
additionalTrustBundle: |
${INDENTED_CERT}
EOF
CANONICAL_REGISTRIES="$(printf "%s\n%s\n" "${RELEASE}" "${TAGGED}" | while read PULLSPEC; do pullspec_registry "${PULLSPEC}"; done | sort | uniq)"
echo "setting up imageContentSources for ${CANONICAL_REGISTRIES}" >&2
echo imageContentSources:
echo "${CANONICAL_REGISTRIES}" | while read REGISTRY; do
printf -- "- mirrors:\n - %s:\n source: %s\n" "${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/localimages/local-release-image" "${REGISTRY}"
done
else
Copy link
Contributor

Choose a reason for hiding this comment

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

Shoot, I think I misread the script. At least in my local tests, what we're getting is this side of the if branch. As a result, these changes are not having any effect because we get whatever the mirror command recommends.

You can see it happening in this log snippet:

2022-01-10 11:32:45 ++(utils.sh:382): image_mirror_config(): [[ ! -s /opt/dev-scripts/registry/ostest-image_mirror-4.10.0-0.nightly-2022-01-10-101431.log ]]
2022-01-10 11:32:45 ++(utils.sh:393): image_mirror_config(): cat /opt/dev-scripts/registry/ostest-image_mirror-4.10.0-0.nightly-2022-01-10-101431.log
2022-01-10 11:32:45 ++(utils.sh:393): image_mirror_config(): sed -n '/To use the new mirrored repository to install/,/To use the new mirrored repository for upgrades/p'
2022-01-10 11:32:45 ++(utils.sh:394): image_mirror_config(): sed -e '/^$/d' -e '/To use the new mirrored repository/d'
2022-01-10 11:32:45 ++(utils.sh:396): image_mirror_config(): cat

So unless CI doesn't use the log file to get the image config (which the repeated failures suggest it is) this isn't going to fix the problem. :-/

In fact, you can see the same log output in the ci job toward the bottom of this file: https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift-metal3_dev-scripts/1333/pull-ci-openshift-metal3-dev-scripts-master-e2e-metal-ipi-upgrade-ovn-ipv6/1480591379284365312/artifacts/e2e-metal-ipi-upgrade-ovn-ipv6/baremetalds-devscripts-setup/artifacts/root/dev-scripts/logs/05_create_install_config-2022-01-10-174239.log

cat ${MIRROR_LOG_FILE} | sed -n '/To use the new mirrored repository to install/,/To use the new mirrored repository for upgrades/p' |\
sed -e '/^$/d' -e '/To use the new mirrored repository/d'
cat << EOF
fi
cat << EOF
additionalTrustBundle: |
${INDENTED_CERT}
EOF
fi
fi
}

Expand Down