Skip to content
Snippets Groups Projects
Commit 39abdeb1 authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-205: Commiting the new tag and push script

parent 118fa9be
Branches
Tags
1 merge request!183Docker image building & pushing with CI pipeline caching
......@@ -107,8 +107,8 @@ docker_store_images:
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- apk add --update make bash
# - apk add --update bind-tools
- apk add --update make bash docker-compose
- apk add --update bind-tools
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- touch /root/.Xauthority
......
......@@ -6,35 +6,63 @@ 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 | grep -E ${DOCKER_TAG} | grep -E ${SKA_REPO} | cut -d' ' -f1); do printf "%s " "${i}"; done)
# Compile a list of LOFAR2.0 images
LOFAR_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E -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
if [ -z "${LOFAR20_DIR+x}" ]; then
echo "LOFAR20_DIR not set, did you forget to source lofar20rc.sh?"
exit 1
fi
# shellcheck source=docker-compose/.env
. "${LOFAR20_DIR}/docker-compose/.env" || exit 1
# Array of tuples separated by space inside double quotes
REMOTE_IMAGES=(
"tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-java ${TANGO_JAVA_VERSION}"
"tango-itango ${TANGO_ITANGO_VERSION}" "tango-pogo ${TANGO_POGO_VERSION}"
"tango-cpp ${TANGO_CPP_VERSION}" "tango-db ${TANGO_DB_VERSION}"
"tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-rest ${TANGO_REST_VERSION}"
)
# 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_IMAGE=${LOFAR_REPO}/${IMAGE}:${VERSION}
tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
for image in "${REMOTE_IMAGES[@]}"; do
# Set, splits tuple into $1 and $2
set -- "$image"
remote_url="${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-${1}:${2}"
local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}-${1}:${2}"
docker pull "${remote_url}"
docker tag "${remote_url}" "${local_url}"
docker push "${local_url}"
done
wait
# docker pull "${SKA_REPO}-${image}:"
## Compile a list of the SKA images
#SKA_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E ${SKA_REPO} | cut -d' ' -f1); do printf "%s " "${i}"; done)
#
## Compile a list of LOFAR2.0 images
#LOFAR_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " "${i}"; done)
#
#echo "$SKA_IMAGES"
#echo "$LOFAR_IMAGES"
#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_IMAGE=${LOFAR_REPO}/${IMAGE}:${VERSION}
# tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
#done
# wait
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment