diff --git a/agent/04_agent_prepare_release.sh b/agent/04_agent_prepare_release.sh index 413666e8b..ff99f01a0 100755 --- a/agent/04_agent_prepare_release.sh +++ b/agent/04_agent_prepare_release.sh @@ -13,11 +13,6 @@ source $SCRIPTDIR/agent/common.sh source $SCRIPTDIR/ocp_install_env.sh source $SCRIPTDIR/oc_mirror.sh -# Temporarily skip preparing the custom local release in case of OVE ISO -if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISO_NO_REGISTRY" ]]; then - exit 0 -fi - # To replace an image entry in the openshift release image, set _LOCAL_REPO so that: # - ENTRYNAME matches an uppercase version of the name in the release image with "-" converted to "_" # - The var value must point to an already locally cloned repo diff --git a/agent/05_agent_configure.sh b/agent/05_agent_configure.sh index 019b8e482..d0457b7dc 100755 --- a/agent/05_agent_configure.sh +++ b/agent/05_agent_configure.sh @@ -240,9 +240,9 @@ function get_mirror_info { # output ImageDigestSources, while prior to that it was ImageContentSources sed -n -E '/imageContentSources|imageDigestSources/,/^ *$/p' ${MIRROR_LOG_FILE} | tail -n+2 > ${tmpmirrorinfo} else - results_dir=$(grep ICSP ${WORKING_DIR}/.oc-mirror.log | grep -o 'oc-mirror[^;]*') - sed -ne '/repository/,/---/p' ${WORKING_DIR}/${results_dir}/imageContentSourcePolicy.yaml > ${tmpmirrorinfo} - sed -i '/repositoryDigestMirrors/d;/---/d' ${tmpmirrorinfo} + # Get the mirror config from the idms file generated by oc-mirror + idms_file=${WORKING_DIR}/working-dir/cluster-resources/idms-oc-mirror.yaml + sed -ne '/imageDigestMirrors:$/,/^status:/{/imageDigestMirrors:$/d;/^status:/d;p;}' $idms_file | sed 's/ //' > ${tmpmirrorinfo} fi if [[ ${AGENT_USE_ZTP_MANIFESTS} == true ]]; then diff --git a/common.sh b/common.sh index 40ff90eea..a041399d4 100644 --- a/common.sh +++ b/common.sh @@ -551,12 +551,6 @@ if [[ "${MIRROR_IMAGES,,}" != "false" ]] && [[ "${MIRROR_IMAGES,,}" == "true" || if [[ "${MIRROR_COMMAND}" == "oc-mirror" ]]; then # Use the string that is generated by the output of oc-mirror export LOCAL_IMAGE_URL_SUFFIX="openshift/release-images" - - # set up the channel using the most recent candidate release - pushd ${WORKING_DIR} - release_candidate=`oc-mirror list releases --channel=candidate-${OPENSHIFT_RELEASE_STREAM} | tail -1` - popd - export OPENSHIFT_RELEASE_TAG="${release_candidate}-$(uname -m)" fi # We're going to be using a locally modified release image diff --git a/oc_mirror.sh b/oc_mirror.sh index f00067a43..65623ec52 100755 --- a/oc_mirror.sh +++ b/oc_mirror.sh @@ -78,26 +78,13 @@ function create_file_imageset() { imageset=$1 - latest_release=$(oc-mirror list releases --channel candidate-${OPENSHIFT_RELEASE_STREAM}| tail -n1) - - # Note that the archiveSize defines the maximum size, in GiB, of each file within the image set. - # This must be large enough to include all images in one file for the publish. cat > "${imageset}" << EOF -apiVersion: mirror.openshift.io/v1alpha2 kind: ImageSetConfiguration -archiveSize: 16 -storageConfig: - local: - path: metadata +apiVersion: mirror.openshift.io/v2alpha1 mirror: platform: - architectures: - - "amd64" - channels: - - name: candidate-${OPENSHIFT_RELEASE_STREAM} - minVersion: $latest_release - maxVersion: $latest_release - type: ocp + graph: true + release: $OPENSHIFT_RELEASE_IMAGE additionalImages: - name: registry.redhat.io/ubi8/ubi:latest EOF @@ -105,6 +92,7 @@ EOF } # Mirror the upstream channel directly to the local registry +# Note that this method is only valid with oc mirror v1 function mirror_to_mirror_publish() { # Create imageset containing the local URL and the OCP release to mirror @@ -124,18 +112,16 @@ function mirror_to_file() { config=${1} pushd ${WORKING_DIR} - oc_mirror_dir=$(mktemp --tmpdir -d "oc-mirror-files--XXXXXXXXXX") - _tmpfiles="$_tmpfiles $oc_mirror_dir" - oc-mirror --config ${config} file://${oc_mirror_dir} --ignore-history - archive_file="$(ls ${oc_mirror_dir}/mirror_seq*)" + oc-mirror --v2 --config ${config} file://${WORKING_DIR} popd - } function publish_image() { + config=${1} + pushd ${WORKING_DIR} - oc-mirror --from $archive_file docker://${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} --dest-skip-tls --skip-metadata-check + oc-mirror --v2 --config ${config} --from file://${WORKING_DIR} docker://${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} popd } @@ -156,6 +142,9 @@ function setup_oc_mirror() { mirror_to_file $tmpimageset - publish_image + publish_image $tmpimageset + + # remove interim file + rm ${WORKING_DIR}/mirror_*.tar fi } diff --git a/oc_mirror_cleanup.sh b/oc_mirror_cleanup.sh index 202b45fa0..4f3765391 100755 --- a/oc_mirror_cleanup.sh +++ b/oc_mirror_cleanup.sh @@ -14,12 +14,8 @@ if [[ -f "/usr/local/bin/oc-mirror" ]]; then sudo rm "/usr/local/bin/oc-mirror" fi -if [ -f "${WORKING_DIR}/.oc-mirror.log" ]; then - rm "${WORKING_DIR}/.oc-mirror.log" -fi - -if [ -d "${WORKING_DIR}/oc-mirror-workspace" ]; then - rm -rf "${WORKING_DIR}/oc-mirror-workspace" +if [ -d "${WORKING_DIR}/working-dir" ]; then + rm -rf "${WORKING_DIR}/working-dir" fi if [ -d "${WORKING_DIR}/quay-install" ]; then