From cf12b2cfe30466e1549c87d50818dcc071d16642 Mon Sep 17 00:00:00 2001
From: Alex Iribarren <Alex.Iribarren@cern.ch>
Date: Mon, 24 Sep 2018 17:20:32 +0200
Subject: [PATCH] Remove debug and fix nomad steps

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 21061b2..2152d0a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,11 +7,8 @@ variables:
 
 before_script:
   - if [ $CI_COMMIT_REF_NAME == 'master' ]; then PREFIX='PROD_'; else PREFIX='DEV_'; fi
-  - printenv | sort
   - eval 'vars=${!'"$PREFIX"'@}'
-  - echo $vars
-  - for v in $vars; do echo $v; echo eval 'export '"${v#$PREFIX}"'=$'$v; eval 'export '"${v#$PREFIX}"'=$'$v; done
-  - printenv | sort
+  - for v in $vars; do eval 'export '"${v#$PREFIX}"'=$'$v; done
 
 stages:
   - prepare
@@ -99,27 +96,27 @@ tag_scheduler:
 
 
 .nomad_deps_template: &nomad_deps
-  before_script:
-    - curl https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip -o /tmp/vault.zip
-    - curl https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip -o /tmp/nomad.zip
-    - unzip /tmp/vault.zip -d /usr/local/bin/
-    - unzip /tmp/nomad.zip -d /usr/local/bin/
-    - export IMAGE_VER="${CI_COMMIT_TAG:-latest}"
-    - vault read nomad/creds/submitjobs -format=json > token.json
-    - export `jq -r '"NOMAD_TOKEN=" + .data.secret_id' token.json`
+  curl https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip -o /tmp/vault.zip &&
+  curl https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip -o /tmp/nomad.zip &&
+  unzip /tmp/vault.zip -d /usr/local/bin/ &&
+  unzip /tmp/nomad.zip -d /usr/local/bin/ &&
+  export IMAGE_VER="${CI_COMMIT_TAG:-latest}" &&
+  vault read nomad/creds/submitjobs -format=json > token.json &&
+  export `jq -r '"NOMAD_TOKEN=" + .data.secret_id' token.json`
 
 deploy_test:
-  <<: *nomad_deps
   stage: deploy_test
   dependencies: []
   script:
+    - *nomad_deps
     - for j in *.nomad; do echo -e "\n${j}:"; nomad job validate <(envsubst < $j); done
-    - for j in *.nomad; do echo -e "\n${j}:"; (nomad job plan -verbose <(envsubst < $j) || [[ $? -eq 0 || $? -eq 1 ]]) || break; done # plan returns 0 or 1 on success
+    - for j in *.nomad; do echo -e "\n${j}:"; (nomad job plan -verbose <(envsubst < $j) || [[ $? -eq 0 || $? -eq 1 ]]) || break; done
+  # plan returns 0 or 1 on success
 
 deploy:
-  <<: *nomad_deps
   stage: deploy
   dependencies:
     - deploy_test
   script:
+    - *nomad_deps
     - for j in *.nomad; do echo -e "\n${j}:"; nomad job run <(envsubst < $j); done
-- 
GitLab