How to rebuild CatalogSource images using latest oc-mirror in Red Hat Enterprise Linux 8
Environment
- Red Hat Enterprise Linux 8
- oc-mirror >= 4.15
- Red Hat OpenShift Container Platform >= 4.15
Issue
- While mirroring operator images using
--rebuild-catalogsparameter, theCatalogSourceimage rebuild is failing withexit status 1 - Unable to rebuild
CatalogSourceimage using latest oc-mirror inRed Hat Enterprise Linux 8 - The rebuild catalog using oc-mirror is failing with
error: error rebuilding catalog images from file-based catalogs: error regenerating the cache for <mirror-registry>/opm/redhat/redhat-operator-index:v4.15: exit status 1
Resolution
-
Download the
opmbinary for the respectivearchitecturefrom the Content from github.com is not included.link.for amd64 see below: # wget https://github.com/operator-framework/operator-registry/releases/download/v1.45.0/linux-amd64-opm -
Rename the downloaded
opmbinary toopm.# mv linux-amd64-opm opm -
Make the
opmbinary executable.# chmod +x opm -
Set the
OPM_BINARYenvironment variable.# export OPM_BINARY=<path>/opm -
Rerun the
oc-mirrorwith newopmbinary which is exported locally.# oc-mirror --config=imageset.yaml docker://<mirror-registry> --rebuild-catalogs
Root Cause
Red Hat Enterprise Linux 8 is not compatible with the opm binary found in the >= 4.15 CatalogSource index image, which is why the oc-mirror on any Red Hat Enterprise Linux 8 system failing for rebuild CatalogSource images >= 4.15. In order to address the This content is not included.bug that prevented oc-mirror from rebuilding, oc-mirror 4.15 onward's rebuilding CatalogSource image no longer doing by oc-mirror. instead an option called --rebuild-catalogs was added for users who wished to rebuild the CatalogSource image according to the imageset. However, even this option isn't working on Red Hat Enterprise Linux 8 because of incompatibility with opm binary.
Diagnostic Steps
Run the oc-mirror against any CatalogSource images >= 4.15 in Red Hat Enterprise Linux 8 using the oc-mirror >= 4.15 and see its exiting with below error:
# oc-mirror --config=imageset.yaml docker://<mirror-registry> --rebuild-catalogs
info: Mirroring completed in 36.31s (44.46MB/s)
Rendering catalog image "<mirror-registry>/redhat/redhat-operator-index:v4.15" with file-based catalog
error: error rebuilding catalog images from file-based catalogs: error regenerating the cache for <mirror-registry>/redhat/redhat-operator-index:v4.15: exit status 1
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.