From db9197ad3b1a7d11c85d44dc5caa160572165684 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Wed, 2 Apr 2025 18:32:01 +0200 Subject: [PATCH] WIP Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at> --- .gitlab-ci.yml | 3 +- .gitlab/check-supported-images.sh | 20 +++++++++++++ .gitlab/remove-unsupported-images.sh | 44 +++++++++++++++------------- 3 files changed, 45 insertions(+), 22 deletions(-) create mode 100755 .gitlab/check-supported-images.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e10109c895..2ce316a38f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,8 @@ variables: DOC_VERSION: "1.8" APP_VERSION: "1.8.0" CHART_VERSION: "1.8.0" - SUPPORTED_VERSIONS: "[\"1.7.0\",\"1.7.1\",\"1.7.2\",\"1.8.0\"]" + 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" CACHE_FALLBACK_KEY: "${CI_DEFAULT_BRANCH}" # This will supress any download for dependencies and plugins or upload messages which would clutter the console log. # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work. diff --git a/.gitlab/check-supported-images.sh b/.gitlab/check-supported-images.sh new file mode 100755 index 0000000000..645f83200c --- /dev/null +++ b/.gitlab/check-supported-images.sh @@ -0,0 +1,20 @@ +#!/bin/bash +echo "Starting registry check ..." + +VERSIONS=(${SUPPORTED_VERSIONS//,/ }) +SERVICES=(${MAINTAINED_SERVICES//,/ }) + +for SERVICE in "${SERVICES[@]}"; do + TAGS=$(regctl tag ls "${CI_REGISTRY2_URL}/${SERVICE}") + for VERSION in "${VERSIONS[@]}"; do + if [[ "$VERSION" == "$APP_VERSION" ]]; then + continue + fi + if [[ ! "${TAGS[*]}" =~ $VERSION ]]; then + >&2 echo "[ERROR] Failed to find image: ${CI_REGISTRY2_URL}/${SERVICE}:${VERSION}" + exit 1 + fi + echo "[DEBUG] Found image: ${CI_REGISTRY2_URL}/${SERVICE}:${VERSION}" + done + echo "[INFO] Finished successfully." +done diff --git a/.gitlab/remove-unsupported-images.sh b/.gitlab/remove-unsupported-images.sh index ccfe3f7df8..9b51ba3faa 100755 --- a/.gitlab/remove-unsupported-images.sh +++ b/.gitlab/remove-unsupported-images.sh @@ -1,26 +1,28 @@ #!/bin/bash -declare -A services -services[0]=analyse-service -services[1]=auth-service-init -services[2]=dashboard-service -services[3]=data-service -services[4]=metadata-service -services[5]=search-db -services[6]=search-service -services[7]=search-service-init -services[8]=storage-service-init -services[9]=ui - echo "Starting registry housekeeping ..." -for key in "${!services[@]}"; do - echo "Checking ${CI_REGISTRY2_URL}/${services[$key]} tags ..." - TAGS=$(regctl tag ls ${CI_REGISTRY2_URL}/${services[$key]}) - for tag in $TAGS; do - res=$(echo "${SUPPORTED_VERSIONS}" | grep "$tag") - if [[ -z $res ]]; then - regctl tag rm ${CI_REGISTRY2_URL}/${services[$key]}:$tag - echo "Deleted unsupported tag ${CI_REGISTRY2_URL}/${services[$key]}:$tag" - fi +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" +VERSIONS=(${SUPPORTED_VERSIONS//,/ }) +SERVICES=(${MAINTAINED_SERVICES//,/ }) + +for SERVICE in "${SERVICES[@]}"; do + TAGS=$(regctl tag ls "registry.datalab.tuwien.ac.at/dbrepo/${SERVICE}") + TAGS=(${TAGS//\n/ }) + for TAG in "${TAGS[@]}"; do + if [[ ! "${VERSIONS[*]}" =~ $TAG ]]; then + echo "===> ${TAG}" + fi done done +#for key in "${!services[@]}"; do +# echo "Checking ${CI_REGISTRY2_URL}/${services[$key]} tags ..." +# TAGS=$(regctl tag ls ${CI_REGISTRY2_URL}/${services[$key]}) +# for tag in $TAGS; do +# res=$(echo "${SUPPORTED_VERSIONS}" | grep "$tag") +# if [[ -z $res ]]; then +# regctl tag rm ${CI_REGISTRY2_URL}/${services[$key]}:$tag +# echo "Deleted unsupported tag ${CI_REGISTRY2_URL}/${services[$key]}:$tag" +# fi +# done +#done -- GitLab