From 81356ea27b98a2e3df01001745e7e39e3557965f Mon Sep 17 00:00:00 2001 From: Quentin Duchemin <quentinduchemin@tuta.io> Date: Tue, 26 May 2020 21:49:39 +0200 Subject: [PATCH] [CI] Proper get of image name when image is used multiple times in Docker Compose --- get-modified-image.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/get-modified-image.sh b/get-modified-image.sh index 23bf3d3e..99a4ea6d 100755 --- a/get-modified-image.sh +++ b/get-modified-image.sh @@ -14,11 +14,18 @@ do ;; esac done + +if [ "$RES" = "" ]; then + echo "Error : no folder starting by pica or meta modified in last commit." + echo "Please check README.md for further understanding." + exit 1; +fi + echo "export MODIFIED_IMAGE=${RES}" > variables echo "Using modified folder : $RES" # Image name with wanted registry and tag, fetched from Docker Compose -RES=$(cat $RES/docker-compose.yml | grep $RES: | cut -d ':' -f2- | cut -d '/' -f2- | tr -d ' ') +RES=$(cat $RES/docker-compose.yml | grep $RES: | cut -d ':' -f2- | cut -d '/' -f2- | tr -d ' ' | head -n 1) if [ "$RES" = "" ]; then echo "Error : no reference to $RES found in docker-compose.yml." echo "Please check the repository README : the name of the folder must be the same as name of the image." -- GitLab