diff --git a/.gitignore b/.gitignore index 153b6a97c89821228c3f24a264a21d53dbbceff9..4dadd58568931d59eb760aa69aaeeb2ac8992fca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ +*.swp *.retry *-openrc.sh gc_key.pem +CICD/files/slurm.conf +CICD/files/slurmdbd.conf +CICD/files/ssh_known_hosts diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b15d1162346d7544dfbdf4caaf6c3950176dd81..e1792faa761fa764ba7426d3728130dde4552c19 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,12 +7,21 @@ stages: # - integration_test_downstream # working but unwanted here # - trigger_pipeline_in_B # working but unwanted here - yamllint -# - heat + - heat - ansible_create_cluster_stage - push_button_spawn_cluster # - e2e - tests -# - clean # only on master + - 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 @@ -21,33 +30,33 @@ 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 ./keys/$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 ./keys/$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 +# only: +# changes: #https://docs.gitlab.com/ee/ci/yaml/#onlychangesexceptchanges +# - "heat/heatcicdwrapper.sh" +# - "heat/*.{yml,yaml}" +# - schedules +# #- CICD/.gitlab-ci.yml yamllint: stage: yamllint @@ -100,7 +109,7 @@ tests: script: - echo "tests stage" - export ANSIBLE_HOST_KEY_CHECKING=False - - source ./keys/$NECTAR_ALLOCATION-openrc.sh + - source ./$NECTAR_ALLOCATION-openrc.sh - python3 dependencies/ansible_cluster_in_a_box/scripts/make_inventory.py static CICD$STACKNAME | tee ./files/cicd_inventory - grep -qv "I could not find any resouces tagged with project_name:" ./files/cicd_inventory #fail if inventory file is empty - chmod 755 ./files/cicd_inventory @@ -131,7 +140,7 @@ manual_cluster_spawn: - echo I still need to handle os password - echo $MANUAL_STACKNAME script: - - source ./keys/$NECTAR_ALLOCATION-openrc.sh + - source ./$NECTAR_ALLOCATION-openrc.sh - bash -x ./heat/heatcicdwrapper.sh create $MANUAL_STACKNAME - git submodule update --init --remote --merge - openstack stack list @@ -154,10 +163,6 @@ clean: - echo "cleanup master" - sleep 30 script: - - source ./keys/$NECTAR_ALLOCATION-openrc.sh - - bash -x ./heat/heatcicdwrapper.sh delete_if_exists _reporefmaster # hardcoding master stackname on purpose here - only: - refs: - - "master" - changes: - - schedules + - source ./$NECTAR_ALLOCATION-openrc.sh + - bash -x ./heat/heatcicdwrapper.sh delete_if_exists $STACKNAME + diff --git a/CICD/ansible_create_cluster_script.sh b/CICD/ansible_create_cluster_script.sh index bf753fd7c95f2bcc7ac478f38d0eb1491000f5e0..a1499f72d3d19938e2a15fe143e7dabe7b836f5b 100755 --- a/CICD/ansible_create_cluster_script.sh +++ b/CICD/ansible_create_cluster_script.sh @@ -9,7 +9,6 @@ cd CICD echo "[ansible_create_cluster_script] Prefixing the Stackname with CICD because heatcicdwrapper does he same" python3 ../scripts/make_inventory.py static CICD$STACKNAME | tee ./files/inventory.$STACKNAME && chmod 755 ./files/inventory.$STACKNAME grep -qv "I could not find any resouces tagged with project_name:" ./files/inventory.$STACKNAME #fail if inventory file is empty -chmod 400 ../gc_key.pem ansible -m ping -i files/inventory.$STACKNAME --key-file ../gc_key.pem all ansible -i files/inventory.$STACKNAME --key-file ../gc_key.pem -a "sudo ls" all