From ac26b5d69db260b6888ea995e1182e2b51ec09fa Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Fri, 13 Dec 2019 13:24:15 +0100 Subject: [PATCH] cloud-infra: Ensure ansible-lint verifies all playbooks Change-Id: I4927a48fa7d9634dc991ba690d9c06663a484fad --- .../scripts/cloud-infra-ansible-lint.sh | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh b/jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh index df2c1e707..1de5601d7 100644 --- a/jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh +++ b/jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh @@ -27,6 +27,9 @@ sudo apt update > /dev/null 2>&1 sudo apt install -y -q=3 gcc libffi-dev libssl-dev lsb-release libpython3-dev \ python3-minimal python3-pip python3-yaml virtualenv > /dev/null 2>&1 +# override ENGINE_ANSIBLE_LINT_VERSION locally before bumping it in engine +export ENGINE_ANSIBLE_LINT_VERSION=4.1.0 + cd $WORKSPACE echo "Info: Install pip==$ENGINE_PIP_VERSION ansible==$ENGINE_ANSIBLE_VERSION and ansible-lint==$ENGINE_ANSIBLE_LINT_VERSION" echo "----------------------------------------------------" @@ -44,27 +47,22 @@ echo "Info: Done" echo "Info: Run ansible-lint on playbooks" echo "----------------------------------------------------" -# the locations of the engine playbooks -playbooks_dir=(engine/playbooks engine/provisioner/bifrost/playbooks engine/provisioner/heat/playbooks \ - engine/installer/kolla/playbooks engine/installer/kubespray/playbooks) - # set exit_code so we exit ourselves rather than ansible-lint bailing out without # verifying all the playbooks declare -i exit_code=0 # lint the playbooks -for dir in ${playbooks_dir[@]}; do - for play in $(ls ${WORKSPACE}/${dir}/*.yml); do - echo "--> Checking '${play}' playbook..." - ansible-lint --nocolor ${play} - lint_exit_code=$? - if [[ $lint_exit_code != 0 ]]; then - exit_code=$lint_exit_code - else - echo [OK] - fi - echo - done +cd $WORKSPACE/engine +for playbook in $(find . -type f -name *.yml | sort); do + echo "--> Checking '${playbook}' playbook..." + ansible-lint --nocolor ${playbook} + lint_exit_code=$? + if [[ $lint_exit_code != 0 ]]; then + exit_code=$lint_exit_code + else + echo [OK] + fi + echo done echo "----------------------------------------------------" echo "Info: Done" -- 2.25.1