Skip to main content

OCI Mirror component

Mirror container images and OCI artifacts to a destination registry with skopeo sync. Provide one image, a YAML file, or inline YAML. The job converts every source to skopeo sync YAML and copies all image platforms.

Mirror an image​

Include common for registry authentication and oci-mirror for the sync job:

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/oci-mirror@stable
inputs:
source: registry.access.redhat.com/ubi10/ubi:latest
target: $CI_REGISTRY_IMAGE/mirrors

The job publishes $CI_REGISTRY_IMAGE/mirrors/ubi:latest. target is a registry and optional namespace prefix, not a complete image reference. skopeo appends the source image's final name and tag; it does not preserve source namespaces. Use separate destination prefixes when different source repositories share an image name. An image without a tag uses latest.

By default the job runs only for tags. Override rules to run on branches or merge requests.

Mirror a YAML file​

Commit a skopeo sync file such as mirrors/images.yml:

registry.access.redhat.com:
images:
ubi10/ubi-micro:
- "${UBI_TAG}"
ghcr.io:
images:
jouve/charts/mailpit:
- "0.34.1"

Set the runtime variable and pass the file path:

variables:
UBI_TAG: latest

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/oci-mirror@stable
inputs:
source: mirrors/images.yml
target: $CI_REGISTRY_IMAGE/mirrors

The result contains mirrors/ubi-micro:latest and mirrors/mailpit:0.34.1 below $CI_REGISTRY_IMAGE. YAML image keys are repository paths without tags; put quoted tags or digests in their lists. An empty list selects every tag, unlike an untagged single-image input, which selects only latest.

The job expands exported environment variables through ci_envsubst in a temporary copy. It does not edit the committed file. Unset variables are left unchanged, and shell expressions are not executed. The same expansion applies to inline YAML and image references.

Use inline YAML​

Use a block string when the source list belongs in the pipeline:

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/oci-mirror@stable
inputs:
source: |
registry.access.redhat.com:
images:
ubi10/ubi-micro:
- "latest"
ghcr.io:
images:
jouve/charts/mailpit:
- "0.34.1"
target: $CI_REGISTRY_IMAGE/mirrors

For multiple images, pass one fully qualified image reference per line:

source: |
registry.access.redhat.com/ubi10/ubi:latest
ghcr.io/jouve/charts/mailpit:0.34.1

The source input accepts a fully qualified image reference, a project-relative YAML file path, or a string containing image references or inline YAML across multiple lines.

Native skopeo selectors such as images-by-tag-regex and images-by-semver, and per-registry TLS settings, are passed through. See the skopeo sync file format.

Tags and digests​

For a reference containing both a tag and digest, such as docker.io/valkey/valkey:9.0.0-alpine3.22@sha256:..., the job removes the digest and syncs the tag. The same rule applies to tag-and-digest strings in YAML tag lists. This avoids the unsupported combined-reference error, but the tag can select different content if it has changed. Use a digest-only reference when content must remain pinned; digest-only sources are not converted to tags.

For chart artifacts, omit the Helm oci:// prefix from the source image:

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/oci-mirror@stable
inputs:
source: ghcr.io/jouve/charts/mailpit:0.34.1
target: $CI_REGISTRY_IMAGE/charts

After a successful job, retrieve the mirrored chart with:

helm pull "oci://${CI_REGISTRY_IMAGE}/charts/mailpit" --version 0.34.1

Migrate from exact destinations​

The previous copy-based component accepted a full target image and could rename or change its tag. Sync accepts a destination prefix instead. For example, change target: $CI_REGISTRY_IMAGE/charts/mailpit:0.34.1 to target: $CI_REGISTRY_IMAGE/charts. Targets containing an image tag or digest are rejected. Sync retains source image names and tags; use a separate copy operation when an arbitrary rename or tag change is required.

Registry authentication​

Configure private source and destination credentials with the central registry authentication guide.

Signature and TLS behavior​

Source signatures are removed by default because many destination registries cannot store signature attachments. Set remove-signatures: false only when the destination supports them and signatures must be preserved. Destination TLS verification remains disabled, matching the previous component behavior; source verification follows the registry configuration or source YAML settings.

Inputs​

NameDescriptionDefaultType
------------
nameocistring
needsThe jobs that this job depends on.[]array
remove-signaturesRemove source image signatures while copying. Disable this only when the destination registry is configured to store signature attachments.trueboolean
rulesThe rules that this job depends on.[{"if":"$CI_COMMIT_TAG","when":"always"},{"when":"never"}]array
sourceA fully qualified image reference, a project-relative Skopeo sync YAML file path, or a multiline string of image references or inline YAML. Environment variables are expanded at runtime.string
stageThe pipeline stage that the jobs belongs to.deploystring
tagsThe runners that this job depends on.[]array
targetThe destination registry and optional namespace, without an image name or tag. Skopeo appends each source image name and tag.string