diff --git a/ci-scripts/ansible-lint.sh b/ci-scripts/ansible-lint.sh index 79af8916b..61e96d9e5 100644 --- a/ci-scripts/ansible-lint.sh +++ b/ci-scripts/ansible-lint.sh @@ -12,18 +12,10 @@ # this requires refactoring roles, skipping for now SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016" -function lint_error_check { - local rc=$? - lint_error=0 - [ $rc -eq 2 ] && lint_error=1 - return $lint_error -} - # lint the playbooks separately to avoid linting the roles multiple times pushd playbooks for playbook in `find . -type f -regex '.*\.y[a]?ml' -print0`; do - ansible-lint -x $SKIPLIST $playbook - lint_error_check + ansible-lint -vvv -x $SKIPLIST $playbook || lint_error=1 done popd @@ -31,11 +23,11 @@ popd # Due to https://github.com/willthames/ansible-lint/issues/210, the roles # directories need to contain a trailing slash at the end of the path. for rolesdir in `find ./roles -maxdepth 1 -type d`; do - ansible-lint -x $SKIPLIST $rolesdir/ - lint_error_check + ansible-lint -vvv -x $SKIPLIST $rolesdir/ || lint_error=1 done -# exit with 1 if we had a least an error or warning. -if [[ "$lint_error" != 0 ]]; then +## exit with 1 if we had a least an error or warning. +if [[ -n "$lint_error" ]]; then exit 1; fi + diff --git a/roles/build-images/tasks/main.yml b/roles/build-images/tasks/main.yml index e1187cbfc..53bc0a120 100644 --- a/roles/build-images/tasks/main.yml +++ b/roles/build-images/tasks/main.yml @@ -63,10 +63,12 @@ modify_image_extract_list: "{{ image_build_extract_list }}" rescue: - - set_fact: image_build_failed=true + - name: Set image_build_failed fact + set_fact: image_build_failed=true always: - - shell: | + - name: Displaying log files from build isolation image + shell: | virt-cat -a {{ build_isolation_image.name }}.qcow2 \ /tmp/builder.log > builder.log 2>&1 || true virt-cat -a {{ build_isolation_image.name }}.qcow2 \ @@ -84,7 +86,8 @@ # because even though the fail was executed it did not actually cause ansible to # exit with nonzero. I suspect it is some interaction with block, so moving the # actual fail out of the block. -- fail: msg='*** Image Build Error ***' +- name: Throw error msg if image build is failing + fail: msg='*** Image Build Error ***' when: image_build_failed|default(false)|bool - when: build_undercloud|bool @@ -150,4 +153,4 @@ shell: >- rm -rf {{ images_working_dir }}/overcloud-full.d {{ images_working_dir }}/ironic-python-agent.d/ sudo chown $USER: {{ images_working_dir }}/overcloud-full.* {{ images_working_dir }}/ironic-python-agent.* - when: cleanup_images_working_dir| bool \ No newline at end of file + when: cleanup_images_working_dir| bool