From 9e5e2a23d47441e767d0f37d16d7e36bc9ad8c0d Mon Sep 17 00:00:00 2001 From: Salt Date: Thu, 5 Aug 2021 01:27:41 -0500 Subject: [PATCH] Break out testing into its own triple-parallelized flow --- .gitlab-ci.yml | 55 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc1c865..ffc2762 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,6 +39,7 @@ after_script: [ -n "$ZEROTIER_NETWORK_ID" ] && \ zerotier-cli leave "$ZEROTIER_NETWORK_ID" +## HOUSEKEEPING Lint: stage: lint allow_failure: yes @@ -50,31 +51,45 @@ Lint: - ansible-lint --version - ansible-lint site.yml -Test: +## TEST +.test: stage: test interruptible: yes except: - pipelines - script: - - ansible-playbook --skip-tags no-test -C site.yml --vault-password-file /vaultpw || error="$?" - - if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi - - if [ -n "$error" ]; then echo "Return code $error"; false; fi + allow_failure: + exit_codes: + - 4 -Play_Against_Pis: - stage: play +pis:test: + extends: .test script: - - ansible-playbook -l tags_pis site.yml --vault-password-file /vaultpw || error="$?" - - if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi - - if [ -n "$error" ]; then echo "Return code $error"; false; fi -Play_Against_Desktops: - stage: play + - ansible-playbook -l tags_pis --skip-tags no-test -C site.yml --vault-password-file /vaultpw +desktop:test: + extends: .test script: - - ansible-playbook -l tags_desktop site.yml --vault-password-file /vaultpw || error="$?" - - if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi - - if [ -n "$error" ]; then echo "Return code $error"; false; fi -Play_Against_Production: - stage: play + - ansible-playbook -l tags_desktop --skip-tags no-test -C site.yml --vault-password-file /vaultpw +prod:test: + extends: .test script: - - ansible-playbook -l tags_prod site.yml --vault-password-file /vaultpw || error="$?" - - if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi - - if [ -n "$error" ]; then echo "Return code $error"; false; fi + - ansible-playbook -l tags_prod --skip-tags no-test -C site.yml --vault-password-file /vaultpw + +## PLAY +.play: + stage: play + allow_failure: + exit_codes: + - 4 + +pis:play: + extends: .play + script: + - ansible-playbook -l tags_pis site.yml --vault-password-file /vaultpw +desktop:play: + extends: .play + script: + - ansible-playbook -l tags_desktop site.yml --vault-password-file /vaultpw +prod:play: + extends: .play + script: + - ansible-playbook -l tags_prod site.yml --vault-password-file /vaultpw