Skip to content
Snippets Groups Projects
Commit 4c46cea8 authored by Jörg Sachse's avatar Jörg Sachse
Browse files

test: use YAML anchors to remove code duplication in Gitlab-CI config

parent 50659953
No related branches found
No related tags found
No related merge requests found
Pipeline #8512 failed
......@@ -12,16 +12,17 @@ default:
- source /opt/molecule/bin/activate
- ansible --version
- molecule --version
after_script:
- source /opt/molecule/bin/activate
- molecule destroy --scenario-name ${SCENARIO}
variables:
ANSIBLE_FORCE_COLOR: 'true'
PY_COLORS: '1'
test-job-debian12:
.job_template: &job_configuration # Hidden yaml configuration that defines an anchor named 'job_configuration'
stage: test
tags:
- "shell"
variables:
SCENARIO: "virtualbox_debian12"
script:
# make sure that Ansible Vaults are present and can be decrypted
- echo "${VAULT_INSTALL_COMMON}" > ../lza_install_common.pass
......@@ -41,52 +42,17 @@ test-job-debian12:
# - molecule verify --scenario-name ${SCENARIO}
- molecule destroy --scenario-name ${SCENARIO}
test-job-debian12:
variables:
SCENARIO: "virtualbox_debian12"
<<: *job_configuration # Add the contents of the 'job_configuration' alias
test-job-alma8:
stage: test
tags:
- "shell"
variables:
SCENARIO: "virtualbox_alma8"
script:
# make sure that Ansible Vaults are present and can be decrypted
- echo "${VAULT_INSTALL_COMMON}" > ../lza_install_common.pass
- export ANSIBLE_VAULT_PASSWORD_FILE=../lza_install_common.pass
- rm -rf ../ansible_vaults/
- git clone https://gitlab+deploy-token-25:${VAULT_ACCESS_TOKEN}@git.slub-dresden.de/slub-referat-2-3/ansible_vaults.git ../ansible_vaults/; \
# run Molecule tests
- molecule syntax --scenario-name ${SCENARIO}
# We cannot use `molecule lint` anymore because:
# - https://github.com/ansible-community/molecule/pull/3802 "Remove lint command"
# - https://github.com/ansible-community/molecule/discussions/3825#discussioncomment-4908366
- yamllint --strict --format colored ./
- ansible-lint --format full --profile production --strict --force-color ./
- molecule create --scenario-name ${SCENARIO}
- molecule converge --scenario-name ${SCENARIO}
- molecule idempotence --scenario-name ${SCENARIO}
# - molecule verify --scenario-name ${SCENARIO}
- molecule destroy --scenario-name ${SCENARIO}
<<: *job_configuration # Add the contents of the 'job_configuration' alias
test-job-ubuntu2204:
stage: test
tags:
- "shell"
variables:
SCENARIO: "virtualbox_ubuntu2204"
script:
# make sure that Ansible Vaults are present and can be decrypted
- echo "${VAULT_INSTALL_COMMON}" > ../lza_install_common.pass
- export ANSIBLE_VAULT_PASSWORD_FILE=../lza_install_common.pass
- rm -rf ../ansible_vaults/
- git clone https://gitlab+deploy-token-25:${VAULT_ACCESS_TOKEN}@git.slub-dresden.de/slub-referat-2-3/ansible_vaults.git ../ansible_vaults/; \
# run Molecule tests
- molecule syntax --scenario-name ${SCENARIO}
# We cannot use `molecule lint` anymore because:
# - https://github.com/ansible-community/molecule/pull/3802 "Remove lint command"
# - https://github.com/ansible-community/molecule/discussions/3825#discussioncomment-4908366
- yamllint --strict --format colored ./
- ansible-lint --format full --profile production --strict --force-color ./
- molecule create --scenario-name ${SCENARIO}
- molecule converge --scenario-name ${SCENARIO}
- molecule idempotence --scenario-name ${SCENARIO}
# - molecule verify --scenario-name ${SCENARIO}
- molecule destroy --scenario-name ${SCENARIO}
<<: *job_configuration # Add the contents of the 'job_configuration' alias
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment