Commit 775dd928 authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch 'sync-image-from-dev-to-com' into 'master'

Add CI job to sync images from dev registry to com

See merge request gitlab-org/build/CNG!235
parent d35d5591
Pipeline #4131 canceled with stages
in 0 seconds
......@@ -403,14 +403,20 @@ gitlab-workhorse-ce:
- push_if_master_or_tag $GITLAB_REF_SLUG
<<: *except-ee
component-details:
image: "alpine:latest"
sync-images:
image: "docker:git"
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
services:
- docker:dind
stage: release
before_script: []
when: manual
script:
- cat artifacts/* > image_versions.txt
- rm artifacts/*
- mv image_versions.txt artifacts
- sh build-scripts/docker_image_sync.sh image_versions.txt
artifacts:
paths:
- artifacts/
......
if [ $# -eq 0 ] ; then
echo 'No file specified'
exit 0
fi
component_file=$1
COM_REGISTRY=${COM_REGISTRY:-"registry.gitlab.com"}
COM_CNG_PROJECT=${COM_CNG_PROJECT:-"gitlab-org/build/cng"}
docker login -u "gitlab-ci-token" -p "${CI_JOB_TOKEN}" "${CI_REGISTRY}"
echo "Pulling images from dev registry"
while IFS=: read -r component tag; do
docker pull "${CI_REGISTRY_IMAGE}/${component}:${tag}"
docker tag "${CI_REGISTRY_IMAGE}/${component}:${tag}" "${COM_REGISTRY}/${COM_CNG_PROJECT}/${component}:${tag}"
done < "${component_file}"
docker login -u "${CI_REGISTRY_USER}" -p "${COM_REGISTRY_PASSWORD}" "${COM_REGISTRY}"
echo "Pushing images to com registry"
while IFS=: read -r component tag; do
docker push "${COM_REGISTRY}/${COM_CNG_PROJECT}/${component}:${tag}"
echo "${COM_REGISTRY}/${COM_CNG_PROJECT}/${component}:${tag}" >> artifacts/cng_images.txt
done < "${component_file}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment