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: stages:
- chores
- validation - validation
- build - build
- prepare - prepare

View File

@ -1,6 +1,9 @@
--- ---
# This yaml is intended to automagically create automation jobs if included # This yaml is intended to automagically create automation jobs if included
variables:
PIPELINE_RUN_TRIGGER: 'false'
PIPELINE_RUN_SCHEDULE: 'true'
include: include:
- local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml
@ -12,35 +15,24 @@ include:
ansible_inventory: '' ansible_inventory: ''
ansible_playbook: '' ansible_playbook: ''
ansible_tags: '' 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: script:
- if [ "0$ansible_inventory" != '0' ]; then ansible_inventory=-i $ansible_inventory; fi - 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 - if [ "0$ansible_tags" != '0' ]; then ansible_tags=$(echo -n "--tags $ansible_tags"); fi
- echo "[DEBUG] ansible_inventory=$ansible_inventory" - echo "[DEBUG] ansible_inventory=$ansible_inventory"
- echo "[DEBUG] ansible_playbook=$ansible_playbook" - echo "[DEBUG] ansible_playbook=$ansible_playbook"
- echo "[DEBUG] ansible_tags=$ansible_tags" - echo "[DEBUG] ansible_tags=$ansible_tags"
# remove galaxy and pip commands when the ansible-ee image is fixed - ansible-playbook $ansible_inventory $ansible_playbook $ansible_tags -vvv
- 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
rules: rules:
# test rules with default never and to specify only when - if: '$NFC_AUTO_JOBS == "false"'
# - if: '$CI_COMMIT_TAG'
# when: never
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# when: never
- if: ' $NFC_AUTO_JOBS == "false"'
when: never 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: exists:
- ".nfc_automation.yaml" - ".nfc_automation.yaml"
when: always 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: exists:
- ".nfc_automation.yaml" - ".nfc_automation.yaml"
when: always when: always
# this if for testing only # this if for testing only
# - if: '$CI_PIPELINE_SOURCE == "push"' # - if: '$CI_PIPELINE_SOURCE == "push"'
# when: always # when: always
@ -49,12 +41,10 @@ include:
- when: never - when: never
Update Git Submodules: Update Git Submodules:
extends: .ansible_playbook extends: .ansible_playbook
variables: variables:
ansible_playbook: '.nfc_automation.yaml' ansible_playbook: 'git_configuration.yaml'
ansible_tags: 'submodule' ansible_tags: 'submodule'
PIPELINE_RUN_TRIGGER: 'false' PIPELINE_RUN_TRIGGER: 'false'
PIPELINE_RUN_SCHEDULE: '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: The CI stages for these jobs are as follows, and in the order expected by the jobs:
- chores
> automated tasks
- validation - validation
> validation of files, commits, Merge Request titles, code quality, license checks. > validation of files, commits, Merge Request titles, code quality, license checks.