Skip to content

Commit 4659b74

Browse files
authored
Merge pull request #88171 from ShaunaDiaz/OCPBUGS-44921
OCPBUGS#44921: simplify mirroring docs MicroShift
2 parents c523867 + 196c552 commit 4659b74

7 files changed

+21
-59
lines changed

modules/microshift-configuring-hosts-for-mirror.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
3+
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="microshift-configuring-hosts-for-mirror_{context}"]

modules/microshift-downloading-container-images.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
3+
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="microshift-downloading-container-images_{context}"]
@@ -11,7 +11,7 @@ After you have located the container list and completed the mirroring prerequisi
1111
.Prerequisites
1212

1313
* You are logged into a host with access to the internet.
14-
* You have ensured that the `.pull-secret-mirror.json` file and `microshift-containers` directory contents are available locally.
14+
* The `.pull-secret-mirror.json` file and `microshift-containers` directory contents are available locally.
1515
1616
.Procedure
1717

@@ -61,5 +61,3 @@ while read -r src_img ; do
6161

6262
done < "${IMAGE_LIST_FILE}"
6363
----
64-
65-
. Transfer the image set to the target environment, such as air-gapped site. Then you can upload the image set into the mirror registry.

modules/microshift-get-mirror-reg-container-image-list.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
3+
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="microshift-get-mirror-reg-container-image-list_{context}"]

modules/microshift-mirror-container-images.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
3+
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
44

55
:_mod-docs-content-type: CONCEPT
66
[id="microshift-mirror-container-images_{context}"]

modules/microshift-mirroring-prereqs.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
3+
// * microshift/microshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
44

55
:_mod-docs-content-type: CONCEPT
66
[id="microshift-configuring-mirroring-prereqs_{context}"]

modules/microshift-upload-cont2-mirror-script.adoc

Lines changed: 0 additions & 27 deletions
This file was deleted.

modules/microshift-uploading-images-to-mirror.adoc

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * microshift/running_applications/microshift-deploy-with-mirror-registry.adoc
3+
// * microshift/pmicroshift_install_rpm_ostree/microshift-deploy-with-mirror-registry.adoc
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="microshift-uploading-container-images-to-mirror_{context}"]
@@ -39,38 +39,29 @@ $ IMAGE_LOCAL_DIR=~/microshift-containers
3939

4040
. Set the environment variables pointing to the mirror registry URL for uploading the container images:
4141
+
42-
[source,terminal]
42+
[source,terminal,subs="+quotes"]
4343
----
44-
$ TARGET_REGISTRY=<registry_host>:<port> <1>
44+
$ TARGET_REGISTRY=_<registry_host>:<port>_ # <1>
4545
----
46-
<1> Replace `<registry_host>:<port>` with the host name and port of your mirror registry server.
46+
<1> Replace `_<registry_host>:<port>_` with the host name and port of your mirror registry server.
4747

4848
. Run the following script to upload the container images to the `${TARGET_REGISTRY}` mirror registry:
4949
+
5050
[source,terminal]
5151
----
52-
image_tag=mirror-$(date +%y%m%d%H%M%S)
53-
image_cnt=1
54-
# Uses timestamp and counter as a tag on the target images to avoid
55-
# their overwrite by the 'latest' automatic tagging
56-
5752
pushd "${IMAGE_LOCAL_DIR}" >/dev/null
5853
while read -r src_manifest ; do
59-
# Remove the manifest.json file name
60-
src_img=$(dirname "${src_manifest}")
61-
# Add the target registry prefix and remove SHA
62-
dst_img="${TARGET_REGISTRY}/${src_img}"
63-
dst_img=$(echo "${dst_img}" | awk -F'@' '{print $1}')
64-
65-
# Run the image upload command
66-
echo "Uploading '${src_img}' to '${dst_img}'"
67-
skopeo copy --all --quiet \
68-
--preserve-digests \
69-
--authfile "${IMAGE_PULL_FILE}" \
70-
dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}:${image_tag}-${image_cnt}"
71-
# Increment the counter
72-
(( image_cnt += 1 ))
73-
54+
local src_img
55+
src_img=$(dirname "${src_manifest}")
56+
# Add the target registry prefix and remove SHA
57+
local -r dst_img="${TARGET_REGISTRY}/${src_img}"
58+
local -r dst_img_no_tag="${TARGET_REGISTRY}/${src_img%%[@:]*}"
59+
# Run the image upload
60+
echo "Uploading '${src_img}' to '${dst_img}'"
61+
skopeo copy --all --quiet \
62+
--preserve-digests \
63+
--authfile "${IMAGE_PULL_FILE}" \
64+
dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}"
7465
done < <(find . -type f -name manifest.json -printf '%P\n')
7566
popd >/dev/null
7667
----

0 commit comments

Comments
 (0)