diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbf25bd..0a76ec3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ stages: # List of stages for jobs, and their order of execution - test - deploy + - check test-job: # This job runs in the test stage. stage: test # It only starts when the job in the build stage completes successfully. @@ -69,3 +70,25 @@ deploy-job: # This job runs in the deploy stage. done sudo systemctl reload bind9.service - echo "Déploiement terminé." + + +check-job: # This job runs in the deploy stage. + stage: check # It only runs when *both* jobs in the test stage complete successfully. + script: + - |+ + echo Recherche de zones déployées + files=$(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA) + if [[ ! -z "$CI_RELOAD" || "$files" =~ .*"gitlab-ci.yml".* ]] + then + files=$(find . -name "*.zone" -printf "%P ") + fi + + count=$(echo $files | wc -w) + linecount=$(( count * 3 + 3)) + + - echo "Vérification des zones $files..." + - sudo grep named /var/log/syslog | tail -n $linecount | grep "reloading configuration succeeded" || exit 4 + - sudo grep named /var/log/syslog | tail -n $linecount | grep "reloading zones succeeded" || exit 5 + - sudo grep named /var/log/syslog | tail -n $linecount | grep "all zones loaded" || exit 6 + - sudo grep named /var/log/syslog | tail -n $linecount | grep "running" || exit 7 + - echo "Déploiement terminé."