GitLab CI pipeline for image cloning
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:rulesrestricts pipeline creation to manual web triggers only - Job
clone_imageruns ondocker:28(Alpine-based, includes buildx with--platformsupport forimagetools create) - Uses
CI_REGISTRY,CI_REGISTRY_USER,CI_REGISTRY_PASSWORDfor login - Passes
REGISTRYand pipeline variables through toscript.sh
script.sh (bug fixes)
-
DRY_RUNandTAG_AS_PATHwere hardcoded tofalse, 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