From 449607cd8d03bed2102ba3d7ca2150f034ae90bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Fri, 26 Feb 2021 17:53:22 +0100
Subject: [PATCH] Lift up Theodolite execution pipeline

---
 .gitlab-ci.yml | 61 ++++++++++++++++++++++++--------------------------
 1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 187fc47b5..6730578da 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,10 +1,12 @@
 stages:
-  - triggers # TODO remove
   - build
   - test
   - check
   - deploy
 
+
+# Theodolite Benchmarks
+
 .benchmarks:
   image: openjdk:11-jdk
   tags:
@@ -237,39 +239,34 @@ deploy-uc4-load-generator:
       allow_failure: true
       
 
+# Theodolite Framework
 
-
-
-
-
-
-
-
-##############
-
-
-
-
-benchmarks-trigger:
-  stage: triggers
-  trigger:
-    include: benchmarks/.gitlab-ci.yml
-    strategy: depend
+deploy-theodolite:
+  stage: deploy
+  tags:
+    - exec-dind
+  image: docker:19.03.1
+  services:
+    - docker:19.03.1-dind
+  variables:
+    DOCKER_TLS_CERTDIR: "/certs"
+  script:
+    - DOCKER_TAG_NAME=$(echo $CI_COMMIT_REF_SLUG- | sed 's/^master-$//')
+    - docker build --pull -t theodolite ./execution
+    - "[ ! $CI_COMMIT_TAG ] && docker tag theodolite ghcr.io/$CR_ORG/theodolite:${DOCKER_TAG_NAME}latest"
+    - "[ ! $CI_COMMIT_TAG ] && docker tag theodolite ghcr.io/$CR_ORG/theodolite:$DOCKER_TAG_NAME$CI_COMMIT_SHORT_SHA"
+    - "[ $CI_COMMIT_TAG ] && docker tag theodolite ghcr.io/$CR_ORG/theodolite:$CI_COMMIT_TAG"
+    - echo $CR_PW | docker login ghcr.io -u $CR_USER --password-stdin
+    - docker push $CR_HOST/$CR_ORG/theodolite
+    - docker logout
   rules:
-    - if: "$CI_COMMIT_TAG"
+    - if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $CI_COMMIT_TAG"
+      when: always
     - changes:
-      - benchmarks/*
-    - when: manual
+      - execution/**/*
+      if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
+      when: always
+    - if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
+      when: manual
       allow_failure: true
 
-execution:
-  stage: triggers
-  trigger:
-    include: execution/.gitlab-ci.yml
-    strategy: depend
-  rules:
-    - if: "$CI_COMMIT_TAG"
-    - changes:
-      - execution/*
-    - when: manual
-      allow_failure: true
-- 
GitLab