From 6accae407af1f09dbf2e75fada4e6156075229ff Mon Sep 17 00:00:00 2001
From: handreas <andreas.hamacher@monash.edu>
Date: Wed, 29 Jan 2020 00:51:03 +0000
Subject: [PATCH] still working on key handling

---
 .gitlab-ci.yml | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e1792faa..d15eb27a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,15 +14,6 @@ stages:
   - tests
   - clean # only on master
 
-setup:
-  stage: .pre
-  tags: 
-  - ansible
-  script: 
-  - echo $GC_KEY > gc_key.pem
-  - chmod 400 gc_key.pem
-  - echo $HPCCICD_openrc > ./$NECTAR_ALLOCATION-openrc.sh
-
 #trigger_pipeline_in_B:
 #  stage: integration_test_downstream
 #  tags: 
@@ -65,14 +56,19 @@ yamllint:
   - yamllint
   script:
     - echo "stage yamllint"
+    - cd CICD
     - ansible-lint -x ANSIBLE0002 master_playbook.yml
-    - yamllint -c ./CICD/.yamllintheat.yaml ./CICD/heat
+    - yamllint -c ./.yamllintheat.yaml ./heat
 
 build_cluster_cicd:
   stage: heat
   allow_failure: false
   tags:
   - heat
+  before_script:
+    - echo $GC_KEY > gc_key.pem
+    - chmod 400 gc_key.pem
+    - echo $HPCCICD_openrc > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - echo "heat stage"
     - source ./$NECTAR_ALLOCATION-openrc.sh
@@ -90,6 +86,10 @@ ansible_create_cluster_stage:
   stage: ansible_create_cluster_stage
   tags: 
   - ansible
+  before_script:
+    - echo $GC_KEY > gc_key.pem
+    - chmod 400 gc_key.pem
+    - echo $HPCCICD_openrc > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - echo "ansible_create_cluster_stage"
     - bash -x ./CICD/ansible_create_cluster_script.sh
@@ -106,6 +106,10 @@ tests:
   stage: tests
   tags:
   - ansible
+  before_script:
+    - echo $GC_KEY > gc_key.pem
+    - chmod 400 gc_key.pem
+    - echo $HPCCICD_openrc > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - echo "tests stage"
     - export ANSIBLE_HOST_KEY_CHECKING=False
@@ -139,6 +143,9 @@ manual_cluster_spawn:
     - echo "for this to work you have to provide a variable called manual stackname"
     - echo I still need to handle os password
     - echo $MANUAL_STACKNAME
+    - echo $GC_KEY > gc_key.pem
+    - chmod 400 gc_key.pem
+    - echo $HPCCICD_openrc > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - source ./$NECTAR_ALLOCATION-openrc.sh
     - bash -x ./heat/heatcicdwrapper.sh create $MANUAL_STACKNAME
@@ -162,6 +169,9 @@ clean:
   before_script:
     - echo "cleanup master"
     - sleep 30
+    - echo $GC_KEY > gc_key.pem
+    - chmod 400 gc_key.pem
+    - echo $HPCCICD_openrc > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - source ./$NECTAR_ALLOCATION-openrc.sh
     - bash -x ./heat/heatcicdwrapper.sh delete_if_exists $STACKNAME
-- 
GitLab