refactor(automation): final logic changes

!29 closes #25
This commit is contained in:
2023-05-27 14:04:10 +09:30
parent 0d3eaa6ac2
commit 1f6ee9ea27
3 changed files with 12 additions and 18 deletions

View File

@ -4,6 +4,7 @@ variables:
stages:
- chores
- validation
- build
- prepare

View File

@ -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"'
- 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'

View File

@ -21,6 +21,9 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
The CI stages for these jobs are as follows, and in the order expected by the jobs:
- chores
> automated tasks
- validation
> validation of files, commits, Merge Request titles, code quality, license checks.