From f1ed7b2ec2f940aa4f5c7b28cd0554fcad2a2586 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Mon, 20 Jan 2025 13:14:56 +0100
Subject: [PATCH] WIP

Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at>
---
 .gitlab-ci.yml            | 13 ++++++++++++-
 .scripts/check-compose.sh |  6 ++++++
 .scripts/check-helm.sh    |  5 +++++
 3 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 .scripts/check-compose.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8bf70c0c71..f9ca1b4940 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,6 +50,7 @@ lint-docker-compose:
     - 'wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq && chmod +x /usr/bin/yq'
     - 'ls -la .scripts'
   script:
+    - "bash .scripts/check-compose.sh"
     - "yq compare -P docker-compose.yml .docker/docker-compose.yml 'volumes.*'"
     - "IGNORE_IMAGE=1 IGNORE_PORTS=1 bash .scripts/check-service.sh 'dbrepo-analyse-service'"
     - "bash .scripts/check-service.sh 'dbrepo-auth-db'"
@@ -75,12 +76,22 @@ lint-helm-chart:
   image: docker.io/alpine:${ALPINE_VERSION}
   stage: lint
   before_script:
-    - apk add helm
+    - apk --no-cache add helm
+    - helm plugin install https://github.com/losisin/helm-values-schema-json.git
     - helm dependency update ./helm/seaweedfs
     - helm package ./helm/seaweedfs --destination ./build
     - helm dependency update ./helm/dbrepo
+    - ./.scripts/check-helm.sh
   script:
     - helm lint ./helm/dbrepo
+    - diff ./values.schema.json ./helm/dbrepo/values.schema.json
+    - diff ./README.md ./helm/dbrepo/README.md
+
+lint-metadata-schema:
+  image: docker.io/alpine:${ALPINE_VERSION}
+  stage: lint
+  script:
+    - diff dbrepo-metadata-db/1_setup-schema.sql helm/dbrepo/files/01-setup-schema.sql
 
 build-metadata-service:
   image: maven:3-openjdk-${JAVA_VERSION}
diff --git a/.scripts/check-compose.sh b/.scripts/check-compose.sh
new file mode 100644
index 0000000000..82f1a51707
--- /dev/null
+++ b/.scripts/check-compose.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+OUTPUT=$(cat .docker/docker-compose.yml | grep "registry.datalab.tuwien.ac.at/.*" | grep -v "$APP_VERSION")
+if [ $? -ne 1 ]; then
+  echo "[ERROR] Some image version(s) differ from APP_VERSION=${APP_VERSION}: ${OUTPUT}"
+  exit 1
+fi
\ No newline at end of file
diff --git a/.scripts/check-helm.sh b/.scripts/check-helm.sh
index 2233434029..2461d7fd47 100755
--- a/.scripts/check-helm.sh
+++ b/.scripts/check-helm.sh
@@ -4,3 +4,8 @@ if [ $? -ne 0 ]; then
 	echo "!!! Please install the Helm values schema plugin first\n"
 	echo "    https://github.com/losisin/helm-values-schema-json"
 fi
+OUTPUT=$(cat helm/dbrepo/values.yaml | grep "registry.datalab.tuwien.ac.at/.*" | grep -v "$APP_VERSION")
+if [ $? -ne 1 ]; then
+  echo "[ERROR] Some image version(s) differ from APP_VERSION=${APP_VERSION} in Helm Char: ${OUTPUT}"
+  exit 1
+fi
\ No newline at end of file
-- 
GitLab