diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc73bab2219b83b0a2042e2f4ddd2f1387aa674a..f3bc2715749ce44f107a2a0920d7a7e2e3f2d90d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ variables: GIT_SUBMODULE_STRATEGY: recursive - STACKNAME: CICD_aciab_$CI_COMMIT_REF_NAME + STACKNAME: CICD_${CI_PROJECT_NAME}_$CI_COMMIT_REF_NAME NECTAR_ALLOCATION: HPCCICD ANSIBLE_HOST_KEY_CHECKING: "False" DEFAULT_PATH: "CICD" @@ -16,33 +16,33 @@ stages: - integration_test #https://docs.gitlab.com/ee/ci/triggers/ - clean - - + + trigger_pipeline_in_Clusterbuild: stage: integration_test - tags: + tags: - ansible script: - echo ${CI_JOB_TOKEN} - curl --request POST --form token=${CI_JOB_TOKEN} --form "variables[TRIGGER_CI_COMMIT_SHA]=${CI_COMMIT_SHA}" --form ref=master https://gitlab.erc.monash.edu.au/api/v4/projects/193/trigger/pipeline # ID is from clusterbuild - only: + only: - ${CI_PROJECT_NAME} == 'ansible_cluster_in_a_box' - + trigger_pipeline_in_monarch: stage: integration_test - tags: + tags: - ansible script: - echo ${CI_JOB_TOKEN} - curl --request POST --form token=${CI_JOB_TOKEN} --form "variables[TRIGGER_CI_COMMIT_SHA]=${CI_COMMIT_SHA}" --form ref=master https://gitlab.erc.monash.edu.au/api/v4/projects/385/trigger/pipeline # ID is from monarch - only: + only: - ${CI_PROJECT_NAME} == 'ansible_cluster_in_a_box' yamllint: stage: lint allow_failure: true - tags: + tags: - yamllint script: - echo "stage yamllint" @@ -67,13 +67,13 @@ yamllint: ansiblelint: allow_failure: true stage: lint - tags: + tags: - ansiblelint script: - echo "stage ansiblelint" - cd CICD - python3 ansiblelint/run_lint.py --targets master_playbook.yml - + build_cluster_cicd: stage: heat allow_failure: false @@ -100,7 +100,7 @@ build_cluster_cicd: ansible_create_cluster_stage: stage: ansible_create_cluster_stage - tags: + tags: - ansible before_script: - cd $DEFAULT_PATH/.. @@ -120,8 +120,8 @@ ansible_create_cluster_stage: - ansible-playbook -i files/inventory.$STACKNAME --key-file ../../gc_key.pem --skip-tags monitoring computenodes.yml | tee nochange.log - echo [ `grep changed= ./nochange.log -c` = `grep changed=0 ./nochange.log -c` ] > bashtest.sh # a crude way to make sure all changed lines are equal to changed=0 - bash ./bashtest.sh - - ansible-playbook -i files/inventory.$STACKNAME --key-file ../../gc_key.pem --skip-tags monitoring --check computenodes.yml - + - ansible-playbook -i files/inventory.$STACKNAME --key-file ../../gc_key.pem --skip-tags monitoring --check computenodes.yml + tests: stage: tests @@ -140,14 +140,14 @@ tests: - grep -qv "I could not find any resouces tagged with project_name:" ./files/inventory.$STACKNAME #fail if inventory file is empty - 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 - - echo -e '[defaults]\r\nallow_world_readable_tmpfiles = True' > ansible.cfg + - echo -e '[defaults]\r\nallow_world_readable_tmpfiles = True' > ansible.cfg # Need to find a better check for sinfo #- ansible -B 30 -i files/inventory.$STACKNAME --key-file ../gc_key.pem -a "find /opt/ -name sinfo -type f" ManagementNodes #- ansible -B 30 -i files/inventory.$STACKNAME --key-file ../gc_key.pem -a "find /opt/ -name squeue -type f" ManagementNodes - ansible -B 30 -i files/inventory.$STACKNAME --key-file ../gc_key.pem -a "systemctl is-active --quiet mariadb" SQLNodes - ansible -B 30 -i files/inventory.$STACKNAME --key-file ../gc_key.pem -a "systemctl is-active --quiet slurmctld" ManagementNodes - ansible -B 30 -i files/inventory.$STACKNAME --key-file ../gc_key.pem -a "systemctl is-active --quiet slurmdbd" ManagementNodes - + - bash -e ./tests/run_tests.sh all "files/inventory.$STACKNAME" "../gc_key.pem" - bash -e ./tests/run_tests.sh ComputeNodes "files/inventory.$STACKNAME" "../gc_key.pem" - bash -e ./tests/run_tests.sh LoginNodes "files/inventory.$STACKNAME" "../gc_key.pem" @@ -155,7 +155,7 @@ tests: - bash -e ./tests/run_tests.sh NFSNodes "files/inventory.$STACKNAME" "../gc_key.pem" - bash -e ./tests/run_tests.sh SQLNodes "files/inventory.$STACKNAME" "../gc_key.pem" - bash -e ./tests/run_tests.sh slurm "files/inventory.$STACKNAME" "../gc_key.pem" - + extended: stage: extended tags: @@ -171,7 +171,7 @@ extended: only: variables: - $EXTENDED != null - + manual_cluster_spawn: stage: push_button_spawn_cluster @@ -193,11 +193,11 @@ manual_cluster_spawn: - export STACKNAME=$MANUAL_STACKNAME - sleep 25 - bash -x CICD/ansible_create_cluster_script.sh - when: manual + when: manual only: refs: - "cicd" - + clean: stage: clean tags: @@ -210,7 +210,7 @@ clean: - source ./$NECTAR_ALLOCATION-openrc.sh - bash -x ./CICD/heat/heatcicdwrapper.sh delete_if_exists $STACKNAME - + # heat_test: # stage: heat_test # allow_failure: false