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

L2SS-205: Smart image management in CI pipeline

parent d91a2039
Branches
Tags
1 merge request!183Docker image building & pushing with CI pipeline caching
...@@ -40,10 +40,13 @@ fi ...@@ -40,10 +40,13 @@ fi
# TODO(Corne): Have this list generated from the .yml files # TODO(Corne): Have this list generated from the .yml files
LOCAL_IMAGES=( LOCAL_IMAGES=(
"elk" "elk-configure-host" "grafana" "prometheus" "lofar-device-base" "elk" "elk-configure-host" "grafana" "prometheus" "lofar-device-base"
"docker-compose_jupyter" "docker-compose_integration-test"
"docker-compose_itango" "docker-compose_tango-prometheus-exporter"
) )
# TBD TODO(Corne): Verify using these images as cache works
# "docker-compose_jupyter" "docker-compose_integration-test"
# "docker-compose_itango" "docker-compose_tango-prometheus-exporter"
#)
# If first argument set run second stage, determine LOCAL_IMAGE to build and # If first argument set run second stage, determine LOCAL_IMAGE to build and
# push from the argument # push from the argument
if [ ! -z "${1+x}" ] && [ "${1}" != "pull" ]; then if [ ! -z "${1+x}" ] && [ "${1}" != "pull" ]; then
...@@ -82,7 +85,7 @@ fi ...@@ -82,7 +85,7 @@ fi
# Final stage, pull images for integration cache try special tag image first # Final stage, pull images for integration cache try special tag image first
# if it fails download latest instead # if it fails download latest instead
if [ -z "${1+x}" ] && [ "${1}" == "pull" ]; then if [ ! -z "${1+x}" ] && [ "${1}" == "pull" ]; then
echo "Pulling images for integration test cache" echo "Pulling images for integration test cache"
# The second argument must pass the tag variable must be set # The second argument must pass the tag variable must be set
...@@ -95,8 +98,12 @@ if [ -z "${1+x}" ] && [ "${1}" == "pull" ]; then ...@@ -95,8 +98,12 @@ if [ -z "${1+x}" ] && [ "${1}" == "pull" ]; then
tag="${2}" tag="${2}"
for image in "${LOCAL_IMAGES[@]}"; do for image in "${LOCAL_IMAGES[@]}"; do
local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${image}"
docker pull "${local_url}:${tag}" || docker pull "${local_url}:latest" docker pull "${local_url}:${tag}" || docker pull "${local_url}:latest"
done done
exit 0 exit 0
fi fi
# Someone nothing ran, that is an error do not fail silently
exit 1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment