Skip to main content

Builds a filtered Operator Lifecycle Manager catalog for disconnected OpenShift installs.

The component renders a source catalog with opm, filters it to one operator package version, validates the file-based catalog, and packages a deployable Helm chart named olm-catalog-<name>. The chart serves the filtered catalog with opm serve and always includes a Service-backed CatalogSource named <operator>-catalog.

The job also writes an ImageSetConfiguration and, unless dry-run is enabled, uploads the generated chart to OCI and runs oc-mirror --v2 to copy the operator images into the target registry.

Variables

NamerequiredtypeHints
CI_REGISTRY_USERrequiredstringGitLab container registry user. Provided by GitLab CI.
CI_REGISTRY_PASSWORDrequiredstringGitLab container registry password. Provided by GitLab CI.

Usage

Create GitLab pipeline file .gitlab-ci.yml:

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/mirror-operator@stable
inputs:
name: cloudnative-pg
operator: cloudnative-pg
olm-catalog: registry.redhat.io/redhat/community-operator-index:v4.20
target-registry: $CI_REGISTRY_IMAGE/disconnected
catalog-registry: $CI_REGISTRY_IMAGE
catalog-source-namespace: openshift-marketplace

Deploy the generated chart from the OCI registry or from the job artifact after reviewing it:

helm upgrade --install cloudnative-pg-catalog oci://registry.gitlab.com/group/project/olm-catalog-cloudnative-pg --version <generated-version> --namespace openshift-marketplace

The generated chart uses the same automatic versioning as the Helm component: tag pipelines use the Git tag, while branch and merge request pipelines produce an unstable 0.0.0+... chart version.

By default the mirror job is manual and only available for tags. Override rules when a project wants to refresh a disconnected catalog from schedules or merge requests.

Set channel or version to narrow the operator package. When version is empty, the latest available version is used. olm-catalog accepts a catalog image or a file-based catalog directory. target-registry is the registry path for oc-mirror, and catalog-registry is the registry path for the generated Helm chart. Use dry-run: true to validate the generated image set, file-based catalog, Helm chart, and CatalogSource without copying or uploading images.

Inputs

NameDescriptionDefaultType
------------
catalog-display-nameDisplay name for the generated CatalogSource.Mirrored Operator Catalogstring
catalog-publisherPublisher for the generated CatalogSource.xrow CI Toolsstring
catalog-registryRegistry path used to publish the generated catalog chart.$CI_REGISTRY_IMAGEstring
catalog-source-namespaceNamespace where the catalog chart is deployed.openshift-marketplacestring
channelOptional operator channel to limit the mirrored package.string
dry-runGenerate and validate manifests without copying images.falseboolean
metadata-imageRegistry image used by oc-mirror to store mirror metadata.$CI_REGISTRY_IMAGE/oc-mirror-metadatastring
nameName suffix for the mirror job and generated chart release.operatorstring
needsThe jobs that this job depends on.[]array
olm-catalogSource OLM catalog image or file-based catalog directory to render with opm.quay.io/operatorhubio/catalog:lateststring
operatorOperator package name to mirror from the catalog.cloudnative-pgstring
rulesThe rules that this job depends on.[{"if":"$CI_COMMIT_TAG","when":"manual"},{"when":"never"}]array
stageThe pipeline stage that the job belongs to.deploystring
tagsThe runners that this job depends on.[]array
target-registryDestination registry path for oc-mirror.$CI_REGISTRY_IMAGEstring
versionOptional operator version to mirror. When empty, the latest available version is used.string