From 965ff001882f1e74b734afe058b5e15e83348420 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Wed, 2 Apr 2025 21:56:37 +0200
Subject: [PATCH] Really check it

Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at>
---
 .gitlab-ci.yml                       | 12 ++++++++++--
 .gitlab/check-supported-images.sh    | 13 ++++++++++---
 .gitlab/remove-unsupported-images.sh | 11 +++++++++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2ce316a38f..9a68069b5e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -696,13 +696,21 @@ verify-dist:
   image: docker.io/alpine:${ALPINE_VERSION}
   stage: verify
   only:
-    refs:
-      - /^release-.*/
+    - /^release-.*/
+    - master
   before_script:
     - "apk add curl"
   script:
     - "curl -v --output /dev/null --fail https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/${APP_VERSION}/dist.tar.gz"
 
+verify-images:
+  image: docker.io/docker:${DOCKER_VERSION}-dind
+  stage: verify
+  only:
+    - master
+  script:
+    - bash ./.gitlab/check-unsupported-images.sh
+
 scan-sonarqube:
   image: sonarsource/sonar-scanner-cli:${SONARQUBE_VERSION}
   stage: scan
diff --git a/.gitlab/check-supported-images.sh b/.gitlab/check-supported-images.sh
index 4b14ccb14b..2f1f804e5d 100755
--- a/.gitlab/check-supported-images.sh
+++ b/.gitlab/check-supported-images.sh
@@ -1,9 +1,16 @@
 #!/bin/bash
 echo "Starting registry check ..."
 
-SUPPORTED_VERSIONS="1.7.3, 1.8.0"
-MAINTAINED_SERVICES="analyse-service, auth-service-init, dashboard-service, dashboard-service-init, data-service, metadata-service, search-db, search-service, search-service-init, storage-service-init, ui"
-CI_REGISTRY2_URL="registry.datalab.tuwien.ac.at/dbrepo"
+if [ -z $SUPPORTED_VERSIONS ]; then
+  echo "[ERROR] Missing environment variable SUPPORTED_VERSIONS" > /dev/stderr
+  exit 1
+elif [ -z $MAINTAINED_SERVICES ]; then
+  echo "[ERROR] Missing environment variable MAINTAINED_SERVICES" > /dev/stderr
+  exit 1
+elif [ -z $CI_REGISTRY2_URL ]; then
+  echo "[ERROR] Missing environment variable CI_REGISTRY2_URL" > /dev/stderr
+  exit 1
+fi
 
 VERSIONS=(${SUPPORTED_VERSIONS//,/ })
 SERVICES=(${MAINTAINED_SERVICES//,/ })
diff --git a/.gitlab/remove-unsupported-images.sh b/.gitlab/remove-unsupported-images.sh
index 141246e5da..d3914e4a7f 100755
--- a/.gitlab/remove-unsupported-images.sh
+++ b/.gitlab/remove-unsupported-images.sh
@@ -1,6 +1,17 @@
 #!/bin/bash
 echo "Starting registry housekeeping ..."
 
+if [ -z $SUPPORTED_VERSIONS ]; then
+  echo "[ERROR] Missing environment variable SUPPORTED_VERSIONS" > /dev/stderr
+  exit 1
+elif [ -z $MAINTAINED_SERVICES ]; then
+  echo "[ERROR] Missing environment variable MAINTAINED_SERVICES" > /dev/stderr
+  exit 1
+elif [ -z $CI_REGISTRY2_URL ]; then
+  echo "[ERROR] Missing environment variable CI_REGISTRY2_URL" > /dev/stderr
+  exit 1
+fi
+
 VERSIONS=(${SUPPORTED_VERSIONS//,/ })
 SERVICES=(${MAINTAINED_SERVICES//,/ })
 
-- 
GitLab