variables:
  GIT_SUBMODULE_STRATEGY: recursive
  STACKNAME: CICD_aciab_$CI_COMMIT_REF_NAME
  NECTAR_ALLOCATION: HPCCICD
  ANSIBLE_HOST_KEY_CHECKING: "False"
  DEFAULT_PATH: "CICD"

stages:
  - lint
  - extended
  #- heat_test
  - heat
  - ansible_create_cluster_stage
  - push_button_spawn_cluster
  - tests
  - integration_test #https://docs.gitlab.com/ee/ci/triggers/
#  - clean
  
 
trigger_pipeline_in_Clusterbuild:
  stage: integration_test
  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

yamllint:
  stage: lint
  allow_failure: true
  tags: 
  - yamllint
  script:
    - echo "stage yamllint"
    - cd CICD
    - yamllint -c ./.yamllintheat.yaml ./heat

ansiblelint:
  allow_failure: true
  stage: lint
  tags: 
  - ansiblelint
  script:
    - echo "stage ansiblelint"
    - cd CICD
    - python3 ansiblelint/run_lint.py --targets master_playbook.yml
