tox: Use 'block: ... always: ...' instead of ignore_errors

Change-Id: Ifc9f420687538a0ed666b41fa707810b184b0c66
This commit is contained in:
Albin Vass 2020-04-27 20:39:31 +02:00
parent 64b347fa63
commit 3487b54baf

View File

@ -38,43 +38,38 @@
{% endif %} {% endif %}
{{ tox_extra_args }} {{ tox_extra_args }}
- name: Run tox - block:
args: - name: Run tox
chdir: "{{ zuul_work_dir }}" args:
environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}" chdir: "{{ zuul_work_dir }}"
command: >- environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
{{ tox_executable }} command: >-
{% if tox_envlist is defined and tox_envlist %} {{ tox_executable }}
-e{{ tox_envlist }} {% if tox_envlist is defined and tox_envlist %}
{% endif %} -e{{ tox_envlist }}
{{ tox_extra_args }} {% endif %}
# Note: This intentionally ignores errors to give us the chance to look {{ tox_extra_args }}
# for file comments in the stdout. In case of an error this will be returned register: tox_output
# in a later task.
ignore_errors: yes
register: tox_output
- name: Look for output # Even though any test environment in tox failed we want to
tox_parse_output: # return file comments produced so always run this.
tox_output: '{{ tox_output.stdout }}' always:
tox_envlist: '{{ tox_envlist }}' - name: Look for output
workdir: '{{ zuul_work_dir }}' tox_parse_output:
when: tox_inline_comments tox_output: '{{ tox_output.stdout }}'
register: file_comments tox_envlist: '{{ tox_envlist }}'
ignore_errors: yes workdir: '{{ zuul_work_dir }}'
when: tox_inline_comments
register: file_comments
failed_when: false
- name: Return file comments to Zuul - name: Return file comments to Zuul
when: when:
- file_comments - tox_inline_comments
- file_comments.file_comments - file_comments.file_comments
delegate_to: localhost delegate_to: localhost
zuul_return: zuul_return:
data: data:
zuul: zuul:
file_comments: '{{ file_comments.file_comments }}' file_comments: '{{ file_comments.file_comments }}'
ignore_errors: yes failed_when: false
- name: Return tox status
fail:
msg: 'tox exited with return code {{ tox_output.rc }}'
when: tox_output.rc != 0