|
|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
---
|
|
|
|
|
# This yaml is intended to automagically create automation jobs if included
|
|
|
|
|
|
|
|
|
|
variables:
|
|
|
|
|
PIPELINE_RUN_TRIGGER: 'false'
|
|
|
|
|
PIPELINE_RUN_SCHEDULE: 'true'
|
|
|
|
|
include:
|
|
|
|
|
- local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml
|
|
|
|
|
|
|
|
|
|
@ -12,35 +15,24 @@ include:
|
|
|
|
|
ansible_inventory: ''
|
|
|
|
|
ansible_playbook: ''
|
|
|
|
|
ansible_tags: ''
|
|
|
|
|
# uncomment below when there is a playbook done
|
|
|
|
|
#ANSIBLE_PLAYBOOK_DIR: '/etc/ansible/playbooks' only use for role in the ansible-ee container
|
|
|
|
|
script:
|
|
|
|
|
- if [ "0$ansible_inventory" != '0' ]; then ansible_inventory=-i $ansible_inventory; fi
|
|
|
|
|
- if [ "0$ansible_tags" != '0' ]; then ansible_tags=$(echo -n "--tags $ansible_tags"); fi
|
|
|
|
|
- echo "[DEBUG] ansible_inventory=$ansible_inventory"
|
|
|
|
|
- echo "[DEBUG] ansible_playbook=$ansible_playbook"
|
|
|
|
|
- echo "[DEBUG] ansible_tags=$ansible_tags"
|
|
|
|
|
# remove galaxy and pip commands when the ansible-ee image is fixed
|
|
|
|
|
- ansible-galaxy collection install community.general
|
|
|
|
|
- pip install python_gitlab==3.14.0
|
|
|
|
|
- ansible-playbook $ansible_inventory $ansible_playbook $ansible_tags -vvv --extra-vars repo_root=$CI_PROJECT_DIR
|
|
|
|
|
- ansible-playbook $ansible_inventory $ansible_playbook $ansible_tags -vvv
|
|
|
|
|
rules:
|
|
|
|
|
# test rules with default never and to specify only when
|
|
|
|
|
# - if: '$CI_COMMIT_TAG'
|
|
|
|
|
# when: never
|
|
|
|
|
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
|
|
|
# when: never
|
|
|
|
|
- if: '$NFC_AUTO_JOBS == "false"'
|
|
|
|
|
when: never
|
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true"'
|
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true" && $CI_COMMIT_BRANCH == "development"'
|
|
|
|
|
exists:
|
|
|
|
|
- ".nfc_automation.yaml"
|
|
|
|
|
when: always
|
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "pipeline" && $PIPELINE_RUN_TRIGGER == "true"'
|
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "pipeline" && $PIPELINE_RUN_TRIGGER == "true" && $CI_COMMIT_BRANCH == "development"'
|
|
|
|
|
exists:
|
|
|
|
|
- ".nfc_automation.yaml"
|
|
|
|
|
when: always
|
|
|
|
|
|
|
|
|
|
# this if for testing only
|
|
|
|
|
# - if: '$CI_PIPELINE_SOURCE == "push"'
|
|
|
|
|
# when: always
|
|
|
|
|
@ -49,12 +41,10 @@ include:
|
|
|
|
|
- when: never
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update Git Submodules:
|
|
|
|
|
extends: .ansible_playbook
|
|
|
|
|
variables:
|
|
|
|
|
ansible_playbook: '.nfc_automation.yaml'
|
|
|
|
|
ansible_playbook: 'git_configuration.yaml'
|
|
|
|
|
ansible_tags: 'submodule'
|
|
|
|
|
PIPELINE_RUN_TRIGGER: 'false'
|
|
|
|
|
PIPELINE_RUN_SCHEDULE: 'false'
|
|
|
|
|
|