From 4112a7059460b935d2e144de3b87ee7a0b51c0a8 Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Wed, 24 Nov 2021 11:50:00 +0000
Subject: [PATCH] L2SS-205: Fix wordsplitting image list in bash

---
 .gitlab-ci.yml                    | 5 +++++
 sbin/tag_and_push_docker_image.sh | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9166b6a98..32d9b88b8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -70,6 +70,11 @@ docker_store_images_changes:
 docker_build_image_devices:
   extends: .base_docker_images
   script:
+    - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh apsct-sim $tag
+    - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh apspu-sim $tag
+    - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh recv-sim $tag
+    - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh sdptr-sim $tag
+    - 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 device-apsct $tag
     - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-apspu $tag
     - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-boot $tag
diff --git a/sbin/tag_and_push_docker_image.sh b/sbin/tag_and_push_docker_image.sh
index 805c34f05..42d9a9861 100755
--- a/sbin/tag_and_push_docker_image.sh
+++ b/sbin/tag_and_push_docker_image.sh
@@ -112,8 +112,12 @@ if [ ! -z "${1+x}" ] && [ "${1}" == "pull" ]; then
   tag="${2}"
 
   for image in "${LOCAL_IMAGES[@]}"; do
-    local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${image}"
-    # Pull images, at least one of the two immages must succeed
+      # Set, splits tuple into $1 and $2. this shadows previous variables
+    # shellcheck disable=SC2086
+    set -- $image
+    local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${1}"
+    # Pull images, at least one of the two images must succeed
+    echo "docker pull ${local_url}:${tag}"
     docker pull "${local_url}:${tag}" || docker pull "${local_url}:latest" || exit 1
   done
 
-- 
GitLab