Skip to content

GitLab CI pipeline for image cloning

Denis Pozdnyakov requested to merge gitlab-ci-cloning into main

Add GitLab CI pipeline for image cloning

What

Adds a .gitlab-ci.yml that exposes script.sh as a manually triggered GitLab CI pipeline, so anyone can copy a public Docker image into our private registry directly from the GitLab UI — no local Docker setup required.

Also fixes two small bugs in script.sh that only surfaced when running in CI.


Pipeline

The pipeline is triggered via CI/CD → Pipelines → Run pipeline and presents three input fields:

Field Type Default Description
SOURCE_IMAGE text Image to copy, e.g. nginx:1.27
PLATFORMS dropdown linux/amd64 linux/amd64 · linux/arm64 · linux/amd64,linux/arm64 · all
DRY_RUN dropdown false Print commands without executing

Authentication uses GitLab's predefined CI_REGISTRY_* variables — no secrets to configure manually.


Changes

.gitlab-ci.yml (new)

  • workflow:rules restricts pipeline creation to manual web triggers only
  • Job clone_image runs on docker:28 (Alpine-based, includes buildx with --platform support for imagetools create)
  • Uses CI_REGISTRY, CI_REGISTRY_USER, CI_REGISTRY_PASSWORD for login
  • Passes REGISTRY and pipeline variables through to script.sh

script.sh (bug fixes)

  • DRY_RUN and TAG_AS_PATH were hardcoded to false, silently ignoring any value set via environment variable. Fixed to use ${VAR:-false} so env vars are respected — consistent with how all other settings in the script work.

Testing

Trigger the pipeline with DRY_RUN=true and any public image. The job log should show [dry-run] prefixed commands with no actual push.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Edited by Denis Pozdnyakov

Merge request reports