From 2c1c72a5d2e33659a04405aafe73b723b65981d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de>
Date: Tue, 21 May 2024 14:18:03 +0200
Subject: [PATCH] Add CI testing

---
 .gitlab-ci.yml | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e8798b8..7f8b29f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,5 @@
 trigger-production:
-    stage: build
+    stage: deploy
     rules:
         - if: $CI_COMMIT_BRANCH == "live_production"
     variables:
@@ -9,3 +9,24 @@ trigger-production:
         # Pipeline B in other project can only be triggered if the user triggering this pipeline has permission to trigger B
         project: videoag_infra/production
         strategy: depend
+
+build-image:
+    stage: build
+    timeout: 30m
+    image:
+        name: gcr.io/kaniko-project/executor:v1.23.0-debug
+        entrypoint: [""]
+    script:
+        - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
+        - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE/videoag_api_testing:$CI_COMMIT_TAG
+
+run-tests:
+    stage: test
+    timeout: 30m
+    variables:
+        VIDEOAG_API_CONFIG: $CI_PROJECT_DIR/config/api_example_config
+    image:
+        name: registry.git.fsmpi.rwth-aachen.de/videoag/backend_api/videoag_api_testing:$CI_COMMIT_TAG
+        entrypoint: [""]
+    script:
+        - $CI_PROJECT_DIR/docker_start.sh -test
\ No newline at end of file
-- 
GitLab