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

L2SS-205: Address some feedback on patch

parent b66f8af4
No related branches found
No related tags found
1 merge request!183Docker image building & pushing with CI pipeline caching
...@@ -49,7 +49,7 @@ stages: ...@@ -49,7 +49,7 @@ stages:
.base_docker_store_images: .base_docker_store_images:
extends: .base_docker_images extends: .base_docker_images
script: script:
# Do not remove 'bash' or statem ent 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 - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh
docker_store_images_master_tag: docker_store_images_master_tag:
extends: .base_docker_store_images extends: .base_docker_store_images
...@@ -347,7 +347,6 @@ integration_test_docker: ...@@ -347,7 +347,6 @@ integration_test_docker:
tag="$CI_COMMIT_REF_SLUG" tag="$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi fi
- echo $tag
- apk add --update make bash docker-compose - apk add --update make bash docker-compose
- apk add --update bind-tools - apk add --update bind-tools
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
...@@ -367,10 +366,6 @@ integration_test_docker: ...@@ -367,10 +366,6 @@ integration_test_docker:
- chmod u+x $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh - chmod u+x $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh
# 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 pull $tag - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag
# TODO(Corne): Remove me
- echo $tag
- docker image ls
- docker ps
# Allow integration test to execute # Allow integration test to execute
- chmod u+x $CI_PROJECT_DIR/sbin/run_integration_test.sh - chmod u+x $CI_PROJECT_DIR/sbin/run_integration_test.sh
# 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
......
...@@ -33,6 +33,8 @@ else ifeq (stop,$(firstword $(MAKECMDGOALS))) ...@@ -33,6 +33,8 @@ else ifeq (stop,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true SERVICE_TARGET = true
else ifeq (restart,$(firstword $(MAKECMDGOALS))) else ifeq (restart,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true SERVICE_TARGET = true
else ifeq (up,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (build,$(firstword $(MAKECMDGOALS))) else ifeq (build,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true SERVICE_TARGET = true
else ifeq (build-nocache,$(firstword $(MAKECMDGOALS))) else ifeq (build-nocache,$(firstword $(MAKECMDGOALS)))
...@@ -169,7 +171,6 @@ bootstrap: pull build # first start, initialise from scratch ...@@ -169,7 +171,6 @@ bootstrap: pull build # first start, initialise from scratch
start: up ## start a service (usage: make start <servicename>) start: up ## start a service (usage: make start <servicename>)
if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi
echo "TEST COMMANDLINE: $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) start $(SERVICE)"
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) start $(SERVICE) $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) start $(SERVICE)
stop: ## stop a service (usage: make stop <servicename>) stop: ## stop a service (usage: make stop <servicename>)
......
#!/bin/bash -e #!/bin/bash -e
function usage {
echo "./$(basename $0)
no arguments, downloads remote images and pushes these to ASTRON registry.
The versions downloaded are controlled by the docker-compose/.env file"
echo ""
echo "./$(basename $0) -h
displays this help message"
echo ""
echo "./$(basename $0) <docker service name> <tag>
downloads latest version of image from the ASTRON registry, builds the
specified service and pushes the image with the specified tag to the
ASTRON registry"
echo ""
echo "./$(basename $0) pull <tag>
downloads all images for the integration test with the specified tag
falling back to 'latest' if unavailable. Should neither exist on the
ASTRON registry the script will exit 1. The images are retagged to match
the output of docker-compose."
}
# list of arguments expected in the input
optstring=":h"
while getopts ${optstring} arg; do
case ${arg} in
h)
usage
exit 0
;;
:)
echo "$0: Must supply an argument to -$OPTARG." >&2
exit 1
;;
?)
echo "Invalid option: -${OPTARG}."
exit 2
;;
esac
done
if [ -z "${LOFAR20_DIR+x}" ]; then if [ -z "${LOFAR20_DIR+x}" ]; then
echo "LOFAR20_DIR not set, did you forget to source lofar20rc.sh?" echo "LOFAR20_DIR not set, did you forget to source lofar20rc.sh?"
exit 1 exit 1
...@@ -8,13 +48,12 @@ fi ...@@ -8,13 +48,12 @@ fi
# shellcheck disable=SC1090 # shellcheck disable=SC1090
. "${LOFAR20_DIR}/docker-compose/.env" || exit 1 . "${LOFAR20_DIR}/docker-compose/.env" || exit 1
# Array of tuples separated by space inside double quotes # List of images and their tag
# These images are downloaded from a remote registry and pushed locally
REMOTE_IMAGES=( REMOTE_IMAGES=(
"tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-java ${TANGO_JAVA_VERSION}" "tango-dsconfig:${TANGO_DSCONFIG_VERSION}" "tango-java:${TANGO_JAVA_VERSION}"
"tango-itango ${TANGO_ITANGO_VERSION}" "tango-pogo ${TANGO_POGO_VERSION}" "tango-itango:${TANGO_ITANGO_VERSION}" "tango-pogo:${TANGO_POGO_VERSION}"
"tango-cpp ${TANGO_CPP_VERSION}" "tango-db ${TANGO_DB_VERSION}" "tango-cpp:${TANGO_CPP_VERSION}" "tango-db:${TANGO_DB_VERSION}"
"tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-rest ${TANGO_REST_VERSION}" "tango-dsconfig:${TANGO_DSCONFIG_VERSION}" "tango-rest:${TANGO_REST_VERSION}"
) )
# If first argument of bash script not set run first stage # If first argument of bash script not set run first stage
...@@ -23,11 +62,8 @@ if [ -z "${1+x}" ]; then ...@@ -23,11 +62,8 @@ if [ -z "${1+x}" ]; then
# Iterate over al the REMOTE_IMAGES and pull them from remote and push local # Iterate over al the REMOTE_IMAGES and pull them from remote and push local
for image in "${REMOTE_IMAGES[@]}"; do for image in "${REMOTE_IMAGES[@]}"; do
# Set, splits tuple into $1 and $2 remote_url="${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-${image}"
# shellcheck disable=SC2086 local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${image}"
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 pull "${remote_url}"
docker tag "${remote_url}" "${local_url}" docker tag "${remote_url}" "${local_url}"
docker push "${local_url}" docker push "${local_url}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment