From 224169c448f352ad3e53f6d5895bf67f5bfca6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CShauna=20Diaz=E2=80=9D?= Date: Thu, 6 Feb 2025 12:55:58 -0500 Subject: [PATCH] OSDOCS-44921: simplify mirrring docs MicroShift --- ...croshift-configuring-hosts-for-mirror.adoc | 2 +- ...croshift-downloading-container-images.adoc | 6 +-- ...t-get-mirror-reg-container-image-list.adoc | 2 +- .../microshift-mirror-container-images.adoc | 2 +- modules/microshift-mirroring-prereqs.adoc | 2 +- ...microshift-upload-cont2-mirror-script.adoc | 27 ------------- ...microshift-uploading-images-to-mirror.adoc | 39 +++++++------------ 7 files changed, 21 insertions(+), 59 deletions(-) delete mode 100644 modules/microshift-upload-cont2-mirror-script.adoc diff --git a/modules/microshift-configuring-hosts-for-mirror.adoc b/modules/microshift-configuring-hosts-for-mirror.adoc index 2bf752f9cb..bbf7b625ae 100644 --- a/modules/microshift-configuring-hosts-for-mirror.adoc +++ b/modules/microshift-configuring-hosts-for-mirror.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc +// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc :_mod-docs-content-type: PROCEDURE [id="microshift-configuring-hosts-for-mirror_{context}"] diff --git a/modules/microshift-downloading-container-images.adoc b/modules/microshift-downloading-container-images.adoc index 274f082089..077c16fca7 100644 --- a/modules/microshift-downloading-container-images.adoc +++ b/modules/microshift-downloading-container-images.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc +// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc :_mod-docs-content-type: PROCEDURE [id="microshift-downloading-container-images_{context}"] @@ -11,7 +11,7 @@ After you have located the container list and completed the mirroring prerequisi .Prerequisites * You are logged into a host with access to the internet. -* You have ensured that the `.pull-secret-mirror.json` file and `microshift-containers` directory contents are available locally. +* The `.pull-secret-mirror.json` file and `microshift-containers` directory contents are available locally. .Procedure @@ -61,5 +61,3 @@ while read -r src_img ; do done < "${IMAGE_LIST_FILE}" ---- - -. Transfer the image set to the target environment, such as air-gapped site. Then you can upload the image set into the mirror registry. \ No newline at end of file diff --git a/modules/microshift-get-mirror-reg-container-image-list.adoc b/modules/microshift-get-mirror-reg-container-image-list.adoc index 6e65827d3d..801a193a6d 100644 --- a/modules/microshift-get-mirror-reg-container-image-list.adoc +++ b/modules/microshift-get-mirror-reg-container-image-list.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc +// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc :_mod-docs-content-type: PROCEDURE [id="microshift-get-mirror-reg-container-image-list_{context}"] diff --git a/modules/microshift-mirror-container-images.adoc b/modules/microshift-mirror-container-images.adoc index 4c0ad71230..7c24187842 100644 --- a/modules/microshift-mirror-container-images.adoc +++ b/modules/microshift-mirror-container-images.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc +// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc :_mod-docs-content-type: CONCEPT [id="microshift-mirror-container-images_{context}"] diff --git a/modules/microshift-mirroring-prereqs.adoc b/modules/microshift-mirroring-prereqs.adoc index 12e9d925e2..6ce9aed515 100644 --- a/modules/microshift-mirroring-prereqs.adoc +++ b/modules/microshift-mirroring-prereqs.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc +// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc :_mod-docs-content-type: CONCEPT [id="microshift-configuring-mirroring-prereqs_{context}"] diff --git a/modules/microshift-upload-cont2-mirror-script.adoc b/modules/microshift-upload-cont2-mirror-script.adoc deleted file mode 100644 index d0bd0d378f..0000000000 --- a/modules/microshift-upload-cont2-mirror-script.adoc +++ /dev/null @@ -1,27 +0,0 @@ -[source,sh] ----- -# Use timestamp and counter as a tag on the target images to avoid -# their overwrite by the 'latest' automatic tagging -image_tag=mirror-$(date +%y%m%d%H%M%S) -image_cnt=1 - -pushd "${IMAGE_LOCAL_DIR}" >/dev/null -while read -r src_manifest ; do - # Remove the manifest.json file name - src_img=$(dirname "${src_manifest}") - # Add the target registry prefix and remove SHA - dst_img="${TARGET_REGISTRY}/${src_img}" - dst_img=$(echo "${dst_img}" | awk -F'@' '{print $1}') - - # Run the image upload command - echo "Uploading '${src_img}' to '${dst_img}'" - skopeo copy --all --quiet \ - --preserve-digests \ - --authfile "${IMAGE_PULL_FILE}" \ - dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}:${image_tag}-${image_cnt}" - # Increment the counter - (( image_cnt += 1 )) - -done < <(find . -type f -name manifest.json -printf '%P\n') -popd >/dev/null ----- \ No newline at end of file diff --git a/modules/microshift-uploading-images-to-mirror.adoc b/modules/microshift-uploading-images-to-mirror.adoc index 078f6e9c40..7e72ea5b14 100644 --- a/modules/microshift-uploading-images-to-mirror.adoc +++ b/modules/microshift-uploading-images-to-mirror.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc +// * microshift/pmicroshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc :_mod-docs-content-type: PROCEDURE [id="microshift-uploading-container-images-to-mirror_{context}"] @@ -39,38 +39,29 @@ $ IMAGE_LOCAL_DIR=~/microshift-containers . Set the environment variables pointing to the mirror registry URL for uploading the container images: + -[source,terminal] +[source,terminal,subs="+quotes"] ---- -$ TARGET_REGISTRY=: <1> +$ TARGET_REGISTRY=_:_ # <1> ---- -<1> Replace `:` with the host name and port of your mirror registry server. +<1> Replace `_:_` with the host name and port of your mirror registry server. . Run the following script to upload the container images to the `${TARGET_REGISTRY}` mirror registry: + [source,terminal] ---- -image_tag=mirror-$(date +%y%m%d%H%M%S) -image_cnt=1 - # Uses timestamp and counter as a tag on the target images to avoid - # their overwrite by the 'latest' automatic tagging - pushd "${IMAGE_LOCAL_DIR}" >/dev/null while read -r src_manifest ; do - # Remove the manifest.json file name - src_img=$(dirname "${src_manifest}") - # Add the target registry prefix and remove SHA - dst_img="${TARGET_REGISTRY}/${src_img}" - dst_img=$(echo "${dst_img}" | awk -F'@' '{print $1}') - - # Run the image upload command - echo "Uploading '${src_img}' to '${dst_img}'" - skopeo copy --all --quiet \ - --preserve-digests \ - --authfile "${IMAGE_PULL_FILE}" \ - dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}:${image_tag}-${image_cnt}" - # Increment the counter - (( image_cnt += 1 )) - + local src_img + src_img=$(dirname "${src_manifest}") + # Add the target registry prefix and remove SHA + local -r dst_img="${TARGET_REGISTRY}/${src_img}" + local -r dst_img_no_tag="${TARGET_REGISTRY}/${src_img%%[@:]*}" + # Run the image upload + echo "Uploading '${src_img}' to '${dst_img}'" + skopeo copy --all --quiet \ + --preserve-digests \ + --authfile "${IMAGE_PULL_FILE}" \ + dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}" done < <(find . -type f -name manifest.json -printf '%P\n') popd >/dev/null ----