From b8cc15e23f587c3f05339789a054da139852cda5 Mon Sep 17 00:00:00 2001
From: Athanasios Karmas <karmas@athenarc.gr>
Date: Mon, 19 Jul 2021 13:55:20 +0000
Subject: [PATCH] Modify gitlab-ci.yml to have a different simplejob per build
 in OpenShift so that we can keep the logs for each build process and do not
 delete previous ones

---
 .gitlab-ci.yml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8419cbbe..5fc997d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,17 +26,17 @@ deploy-build-environment:
   script:
     # create job description file
     - chmod a+x create_job.sh
-    - ./create_job.sh $BUILD_ENV $OP $SWIFT_FILE
-    - cat simplejob.yml
+    - ./create_job.sh $BUILD_ENV $OP $SWIFT_FILE $CI_PIPELINE_ID
+    - cat simplejob${CI_PIPELINE_ID}.yml
     # select the project in openshift
     - oc project jupyterhub-int
     # delete the job (if exist)
-    - oc delete job simplejob || true
+    #- oc delete job simplejob || true
     # start the deploy job
-    - oc create -f simplejob.yml
+    - oc create -f simplejob${CI_PIPELINE_ID}.yml
     # wait for job to finish https://stackoverflow.com/questions/5073453wait-for-kubernetes-job-to-complete-on-either-failure-success-using-command-line
-    - oc get job/simplejob -o=jsonpath='{.status}' -w && oc get job/simplejob -o=jsonpath='{.status.conditions[*].type}' | grep -i -E 'failed|complete' || echo 'Failed' 
-    - oc logs jobs/simplejob
+    - oc get job/simplejob${CI_PIPELINE_ID} -o=jsonpath='{.status}' -w && oc get job/simplejob -o=jsonpath='{.status.conditions[*].type}' | grep -i -E 'failed|complete' || echo 'Failed' 
+    - oc logs jobs/simplejob${CI_PIPELINE_ID}
   tags:
     - shell-runner
 
-- 
GitLab