From 35b81ca1ebc37d548843d05bc144678d4e99037d Mon Sep 17 00:00:00 2001
From: handreas <andreas.hamacher@monash.edu>
Date: Sun, 2 Feb 2020 10:19:33 +0000
Subject: [PATCH] two stages enabled as manual. delete stack and heat test

Former-commit-id: c4c815c4288dda9341afb5d9d2dcfbc3ade444e2
---
 .gitlab-ci.yml | 65 +++++++++++++++++++++++++++++---------------------
 1 file changed, 38 insertions(+), 27 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d30fc623..92f80bf0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,7 @@ stages:
 #  - integration_test_downstream # working but unwanted here
 #  - trigger_pipeline_in_B   # working but unwanted here
   - lint
+  - delete_stack
   - extended
   - heat
   - ansible_create_cluster_stage
@@ -25,33 +26,28 @@ stages:
 #  script:
 #  - "curl --request POST --form token=${CI_JOB_TOKEN} --form ref=master https://gitlab.erc.monash.edu.au/api/v4/projects/1085/trigger/pipeline"  # ID is from pysshauthz
 
-# heat_test:
-#   stage: heat
-#   allow_failure: false
-#   tags:
-#   - heat
-#   before_script:
-#     - source ./$NECTAR_ALLOCATION-openrc.sh
-#     - export HEAT_TEST_STACKNAME=_TESTING_HEAT
-#     - bash -x ./heat/heatcicdwrapper.sh delete_if_exists $HEAT_TEST_STACKNAME
-#     - sleep 60
-#   script:
-#     - echo "heat_test stage"
-#     - source ./$NECTAR_ALLOCATION-openrc.sh
-#     - bash -x ./heat/heatcicdwrapper.sh create $HEAT_TEST_STACKNAME
-#     - openstack stack list
-#     - bash -x ./heat/heatcicdwrapper.sh update $HEAT_TEST_STACKNAME
-#     - openstack stack list
-#     - bash -x ./heat/heatcicdwrapper.sh delete_if_exists $HEAT_TEST_STACKNAME
-#     - openstack stack list
-#   after_script:
-#     - sleep 20 # artifically wait a bit to make sure it is really dead
-#   only:
-#     changes: #https://docs.gitlab.com/ee/ci/yaml/#onlychangesexceptchanges
-#     - "heat/heatcicdwrapper.sh"
-#     - "heat/*.{yml,yaml}"
-#     - schedules
-#     #- CICD/.gitlab-ci.yml
+heat_test:
+  stage: heat
+  allow_failure: false
+  tags:
+  - heat
+  before_script:
+    - source ./$NECTAR_ALLOCATION-openrc.sh
+    - export HEAT_TEST_STACKNAME=_TESTING_HEAT
+    - bash -x ./heat/heatcicdwrapper.sh delete_if_exists $HEAT_TEST_STACKNAME
+    - sleep 60
+  script:
+    - echo "heat_test stage"
+    - source ./$NECTAR_ALLOCATION-openrc.sh
+    - bash -x ./heat/heatcicdwrapper.sh create $HEAT_TEST_STACKNAME
+    - openstack stack list
+    - bash -x ./heat/heatcicdwrapper.sh update $HEAT_TEST_STACKNAME
+    - openstack stack list
+    - bash -x ./heat/heatcicdwrapper.sh delete_if_exists $HEAT_TEST_STACKNAME
+    - openstack stack list
+  after_script:
+    - sleep 20 # artifically wait a bit to make sure it is really dead
+  when: manual
 
 yamllint:
   stage: lint
@@ -64,6 +60,21 @@ yamllint:
     # - ansible-lint -c .yamllintconf.yaml -x ANSIBLE0002 master_playbook.yml
     - yamllint -c ./.yamllintheat.yaml ./heat
 
+delete_stack_manual:
+  stage: delete_stack
+  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
+    - openstack stack list
+    - bash -x ./CICD/heat/heatcicdwrapper.sh delete_if_exists $STACKNAME
+  when: manual
+
 ansiblelint:
   allow_failure: true
   stage: lint
-- 
GitLab