Skip to content
Snippets Groups Projects
Commit 0a19b5d0 authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Merge branch 'L2SS-232-Docker_tag_and_push_script' into 'master'

L2SS-232: Add a Docker tag/push script for local images

Closes L2SS-232

See merge request !49
parents f1cde1ea fccd0901
No related branches found
No related tags found
1 merge request!49L2SS-232: Add a Docker tag/push script for local images
#! /usr/bin/env bash -e
# Tag and push which image version?
DOCKER_TAG=latest
# Change to git tag or git hash if no tag
VERSION=$(date +"%Y-%M-%d")
SKA_REPO="nexus.engageska-portugal.pt/ska-docker"
LOFAR_REPO="git.astron.nl:5000/lofar2.0/tango"
# Compile a list of the SKA images
SKA_IMAGES=$(for i in $(docker images | egrep ${DOCKER_TAG} | egrep ${SKA_REPO} | cut -d' ' -f1); do printf "%s " ${i}; done)
# Compile a list of LOFAR2.0 images
LOFAR_IMAGES=$(for i in $(docker images | egrep ${DOCKER_TAG} | egrep -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " ${i}; done)
function tag_and_push()
{
(
docker tag ${1} ${2}
docker push ${2}
) &
}
# Rename the SKA images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo
for IMAGE in ${SKA_IMAGES}; do
PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION}
tag_and_push ${IMAGE} ${PUSH_IMAGE}
done
# Rename the LOFAR2.0 images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo
for IMAGE in ${LOFAR_IMAGES}; do
PUSH_IMAGES=${LOFAR_REPO}/${IMAGE}:${VERSIN}
tag_and_push ${IMAGE} ${PUSH_IMAGE}
done
wait
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment