From 8037c7bea5ba77623c4beb15106a39bdf5e18397 Mon Sep 17 00:00:00 2001
From: Lennart Kramer <lennart.kramer@stud.uni-goettingen.de>
Date: Fri, 10 Jul 2020 14:18:08 +0200
Subject: [PATCH] version with tag

---
 .gitlab-ci.yml | 6 +++++-
 build.sh       | 3 ++-
 buildimage.sh  | 4 ++--
 src/web/web.go | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5d029df..f75c763 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,7 +30,10 @@ build_webservice:
   tags:
     - docker
   script:
-    - ./build.sh ${REGISTRY}
+    - ./build.sh "$REGISTRY" "$CI_COMMIT_TAG"
+  only:
+    - tags
+
 
 test_maxima:
   image: "$REGISTRY/moodle-ci-stack"
@@ -50,3 +53,4 @@ test_maxima:
     - docker
   script:
     - bash testimage.sh
+  when: manual
diff --git a/build.sh b/build.sh
index b20d1c5..91bf00f 100755
--- a/build.sh
+++ b/build.sh
@@ -4,5 +4,6 @@ while read -r line; do
 	maxima_version="$(echo "$line" | cut -f1)"
 	sbcl_version="$(echo "$line" | cut -f2)"
 	stack_version="$(echo "$line" | cut -f3)"
-	./buildimage.sh "${sbcl_version}" "${maxima_version}" "$stack_version" "stack/$stack_version/maxima" "${REGISTRY}" || exit 1
+	goemaxima_version="$2"
+	./buildimage.sh "${sbcl_version}" "${maxima_version}" "$stack_version" "stack/$stack_version/maxima" "${REGISTRY}" "$goemaxima_version" || exit 1
 done
diff --git a/buildimage.sh b/buildimage.sh
index 2361efe..6d0abac 100755
--- a/buildimage.sh
+++ b/buildimage.sh
@@ -4,13 +4,14 @@
 # arg3: stack or moodle version: "stack-XXX" or "moodlev.X"
 # arg4: LIB_PATH
 # arg5: REGISTRY IP
+# arg6: version of goemaxima
 #
 echo "starting to build image for:"
 echo "sbcl: $1"
 echo "maxima: $2"
 echo "stack: $3"
 # tag the image
-IMAGENAME="$5/goemaxima:$3"
+IMAGENAME="$5/goemaxima-$3:$6"
 # check if the image already exists on the server
 docker pull "${IMAGENAME}"
 # build it
@@ -20,7 +21,6 @@ else
 	docker build -t "${IMAGENAME}" --build-arg MAXIMA_VERSION="$2" --build-arg SBCL_VERSION="$1" --build-arg LIB_PATH="$4" . || exit 1
 fi
 echo "${IMAGENAME} wurde erfolgreich gebaut."
-# testing?
 # push it
 docker push "${IMAGENAME}"
 
diff --git a/src/web/web.go b/src/web/web.go
index 4c2408b..dd0a7ec 100644
--- a/src/web/web.go
+++ b/src/web/web.go
@@ -239,7 +239,7 @@ func process_cleanup(user *User, user_queue chan<- *User, tmp_dir string) {
 func handler(w http.ResponseWriter, r *http.Request, queue <-chan *ChildProcess, user_queue chan<- *User, metrics *Metrics) {
 	if r.Method == "GET" && r.FormValue("input") == "" {
 		hostname, _ := os.Hostname()
-		fmt.Fprintf(w, "Hostname: %s, version: 0.1.1\n", hostname)
+		fmt.Fprintf(w, "Hostname: %s, version: 1.0.0\n", hostname)
 		return
 	}
 	// the maxima input to be evaluated
-- 
GitLab