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

L2SS-205: Programmatically only pull images needed for integration

parent a05fe671
No related branches found
No related tags found
1 merge request!183Docker image building & pushing with CI pipeline caching
...@@ -66,25 +66,6 @@ docker_store_images_changes: ...@@ -66,25 +66,6 @@ docker_store_images_changes:
refs: refs:
- tags - tags
- master - master
# TODO(Corne): Remove this after first run
docker_build_image_devices:
extends: .base_docker_images
script:
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh apsct-sim latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh apspu-sim latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh recv-sim latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh sdptr-sim latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh unb2-sim latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-apsct latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-apspu latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-boot latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-docker latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-observation_control latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-recv latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-sdp latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-sst latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-unb2 latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-xst latest
docker_build_image_all: docker_build_image_all:
extends: .base_docker_images extends: .base_docker_images
only: only:
...@@ -219,6 +200,96 @@ docker_build_image_unb2_sim: ...@@ -219,6 +200,96 @@ docker_build_image_unb2_sim:
script: script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell # Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh unb2-sim $tag - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh unb2-sim $tag
docker_build_image_device_apsct:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-aspct.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-aspct $tag
docker_build_image_device_apspu:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-apspu.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-apspu $tag
docker_build_image_device_boot:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-boot.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-boot $tag
docker_build_image_device_docker:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-docker.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-docker $tag
docker_build_image_device_ovservation_control:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-observation_control.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-observation_control $tag
docker_build_image_device_recv:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-recv.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-recv $tag
docker_build_image_device_sdp:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-sdp.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-sdp $tag
docker_build_image_device_sst:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-sst.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-sst $tag
docker_build_image_device_unb2:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-unb2.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-unb2 $tag
docker_build_image_device_xst:
extends: .base_docker_images_except
only:
changes:
- docker-compose/device-xst.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-xst $tag
newline_at_eof: newline_at_eof:
stage: linting stage: linting
before_script: before_script:
......
...@@ -36,30 +36,33 @@ if [ -z "${1+x}" ]; then ...@@ -36,30 +36,33 @@ if [ -z "${1+x}" ]; then
exit 0 exit 0
fi fi
# Tuple of images and queries to detect changes # Triple tuple of docker-compose names, image names and if necessary for
# integration tests.
# 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" "elk-configure-host elk-configure-host" "elk elk y" "elk-configure-host elk-configure-host y"
"lofar-device-base lofar-device-base" "lofar-device-base lofar-device-base y"
"apsct-sim docker-compose_apsct-sim" "apspu-sim docker-compose_apspu-sim" "apsct-sim docker-compose_apsct-sim y" "apspu-sim docker-compose_apspu-sim y"
"recv-sim docker-compose_recv-sim" "sdptr-sim docker-compose_sdptr-sim" "recv-sim docker-compose_recv-sim y" "sdptr-sim docker-compose_sdptr-sim y"
"unb2-sim docker-compose_unb2-sim" "unb2-sim docker-compose_unb2-sim y"
"device-apsct device-apsct" "device-apspu device-apspu" "device-apsct device-apsct y" "device-apspu device-apspu y"
"device-boot device-boot" "device-docker device-docker" "device-boot device-boot y" "device-docker device-docker y"
"device-observation_control device-observation_control" "device-observation_control device-observation_control y"
"device-recv device-recv" "device-sdp device-sdp" "device-sst device-sst" "device-recv device-recv y" "device-sdp device-sdp y"
"device-unb2 device-unb2" "device-xst device-xst" "device-sst device-sst y" "device-unb2 device-unb2 y"
"device-xst device-xst y"
"itango docker-compose_itango"
"itango docker-compose_itango y"
"grafana grafana n" "prometheus prometheus n"
"jupyter docker-compose_jupyter n"
"integration-test docker-compose_integration-test n"
"tango-prometheus-exporter docker-compose_tango-prometheus-exporter n"
) )
# "grafana grafana"
# "prometheus prometheus"
# "jupyter docker-compose_jupyter"
# "integration-test docker-compose_integration-test"
# "tango-prometheus-exporter 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
...@@ -119,16 +122,20 @@ if [ ! -z "${1+x}" ] && [ "${1}" == "pull" ]; then ...@@ -119,16 +122,20 @@ if [ ! -z "${1+x}" ] && [ "${1}" == "pull" ]; then
# Set, splits tuple into $1 and $2. this shadows previous variables # Set, splits tuple into $1 and $2. this shadows previous variables
# shellcheck disable=SC2086 # shellcheck disable=SC2086
set -- $image set -- $image
local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${2}"
# Pull images, at least one of the two images must succeed # Only download images which are needed for integration test
echo "docker pull ${local_url}:${tag}" if [ "${3}" == "y" ]; then
docker pull "${local_url}:${tag}" || docker pull "${local_url}:latest" || exit 1 local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${2}"
# Ensure the images will have the same tags as generated by docker-compose # Pull images, at least one of the two images must succeed
docker tag "${local_url}:${tag}" "${2}" || docker tag "${local_url}:latest" "${2}" || exit 1 echo "docker pull ${local_url}:${tag}"
docker pull "${local_url}:${tag}" || docker pull "${local_url}:latest" || exit 1
# Ensure the images will have the same tags as generated by docker-compose
docker tag "${local_url}:${tag}" "${2}" || docker tag "${local_url}:latest" "${2}" || exit 1
fi
done done
exit 0 exit 0
fi fi
# Someone nothing ran, that is an error do not fail silently # Somehow nothing ran, that is an error do not fail silently
exit 1 exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment