Skip to content

Commit 088e155

Browse files
chore(mirror-plugins.sh) Add fallback to quay.io for unreleased plugins in mirror script (#2294)
* fix: Add fallback to quay.io for unreleased plugins in mirror script When mirroring plugins from catalog index, if a plugin references registry.access.redhat.com/rhdh but is not yet released there, the script now falls back to pulling from quay.io/rhdh instead. This enables testing of mirroring catalog indexes that contain plugins which have not yet been published to registry.access.redhat.com. Fixes: RHIDP-11725 * update: Limit fallback to the rhdh namespace Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> * update: Consider a more robust failure check Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> * fix(mirror-plugins): robust error handling for skopeo fallback logic * emit specific warning for unauthorized, could be credentials issue or non-existent repo Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> * use infof instead of warn Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> * update: Add fallback to quay.io for unreleased RHDH plugins and catalog indexes. Use skopeo inspect to check image existence instead of parsing error strings. * fix: USED_FALLBACK is being set inside a subshell (command substitution) so it is not visible in the parent shell Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> * chore: update to be compatible with 3-level registries * Patch the registry * Allow separate internal-registry URL * refactor(mirror-plugins): eliminate global variables in get_effective_registry_ref Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> * Update mirror-plugins adoc and fix silent failures Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> --------- Signed-off-by: Fortune-Ndlovu <fndlovu@redhat.com> Co-authored-by: Zbyněk Drápela <zbynek.drapela@gmail.com>
1 parent f2d1a88 commit 088e155

2 files changed

Lines changed: 253 additions & 69 deletions

File tree

‎.rhdh/docs/mirror-dynamic-plugins.adoc‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ bash mirror-plugins.sh \
2929
--to-registry registry.example.com
3030
----
3131

32+
NOTE: The script automatically falls back to `quay.io/rhdh` if plugins are not yet available in `registry.access.redhat.com/rhdh`. This is normal for unreleased or development builds. You may see warning messages indicating fallback usage.
33+
3234
[#_fully_disconnected_workflow]
3335
==== Mirroring to a fully disconnected environment
3436

@@ -85,6 +87,10 @@ Create a text file listing the plugins to mirror (one per line):
8587
oci://quay.io/rhdh-plugin-catalog/backstage-community-plugin-quay:1.8.0--1.22.1!backstage-community-plugin-quay
8688
oci://quay.io/rhdh-plugin-catalog/backstage-community-plugin-github-actions:1.8.0--0.11.1!backstage-community-plugin-github-actions
8789
oci://quay.io/rhdh-plugin-catalog/backstage-community-plugin-azure-devops:1.8.0--0.8.2!backstage-community-plugin-azure-devops
90+
oci://quay.io/rhdh-plugin-catalog/backstage-community-plugin-dynatrace:1.8.0--10.6.0!backstage-community-plugin-dynatrace
91+
92+
# 3-level registry paths (e.g., ghcr.io) are also supported
93+
oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/backstage-community-plugin-scaffolder-backend-module-quay:bs_1.45.3__2.14.0
8894
----
8995

9096
Mirror the plugins from the file:
@@ -110,8 +116,48 @@ bash mirror-plugins.sh \
110116
--to-registry registry.example.com
111117
----
112118

119+
[#_ocp_internal_registry]
120+
==== Mirroring to OpenShift Container Platform internal registry
121+
122+
When mirroring to OpenShift Container Platform (OCP), you may need to specify different registry addresses for pushing images versus the in-cluster address that RHDH uses to pull plugins. Use `--to-registry` for the external route (used for pushing) and `--internal-registry` for the in-cluster service address (used in catalog index references).
123+
124+
[source,console]
125+
----
126+
bash mirror-plugins.sh \
127+
--plugin-index oci://quay.io/rhdh/plugin-catalog-index:1.9 \
128+
--to-registry default-route-openshift-image-registry.apps.example.com \
129+
--internal-registry image-registry.openshift-image-registry.svc:5000
130+
----
131+
132+
NOTE: The `--internal-registry` option is only needed when the push registry differs from the in-cluster address. If not specified, it defaults to the `--to-registry` value. The script automatically updates the catalog index with the correct in-cluster registry references.
133+
113134
=== Using mirrored plugins
114135

115136
After mirroring completes, the script generates a `rhdh-plugin-mirroring-summary.txt` file containing mappings of all mirrored plugins. Use this file to reference the correct mirrored plugin URLs when configuring your RHDH deployment.
116137

138+
IMPORTANT: When mirroring from a catalog index, the script automatically rebuilds the catalog index image with updated registry references pointing to your mirrored location. This ensures the catalog index works correctly in your disconnected environment. The mirrored catalog index is available at the same path as the original, but with your target registry.
139+
117140
For Operator deployments, configure the `Backstage` Custom Resource with the mirrored plugin references. For Helm deployments, update your values file with the mirrored plugin references. See link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.8/html/installing_and_viewing_plugins_in_red_hat_developer_hub/assembly-third-party-plugins#proc-load-plugin-oci-image_assembly-install-third-party-plugins-rhdh[Red Hat Developer Hub Documentation] for configuration details.
141+
142+
=== Additional features
143+
144+
==== Automatic registry fallback
145+
146+
The script automatically falls back to `quay.io/rhdh` when plugins are not yet available in `registry.access.redhat.com/rhdh`. This is useful for:
147+
* Unreleased plugins that are only available in development registries
148+
* Testing with pre-release builds
149+
150+
You may see warning messages like:
151+
----
152+
[WARN] Image not found at registry.access.redhat.com, using fallback: quay.io
153+
----
154+
155+
This is expected behavior and indicates the script is using the fallback registry.
156+
157+
==== Registry path compatibility
158+
159+
The script automatically handles different registry path formats:
160+
* 2-level paths: `registry.io/namespace/image` (e.g., `quay.io/rhdh/plugin`)
161+
* 3-level paths: `registry.io/org/sub/image` (e.g., `ghcr.io/redhat-developer/rhdh-plugin-export-overlays/plugin`)
162+
163+
For OpenShift Container Platform internal registries (which only support 2-level paths), the script automatically flattens 3-level paths to 2-level paths by keeping only the last two path elements.

0 commit comments

Comments
 (0)