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,7 +38,8 @@
{% endif %} {% endif %}
{{ tox_extra_args }} {{ tox_extra_args }}
- name: Run tox - block:
- name: Run tox
args: args:
chdir: "{{ zuul_work_dir }}" chdir: "{{ zuul_work_dir }}"
environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}" environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
@ -48,33 +49,27 @@
-e{{ tox_envlist }} -e{{ tox_envlist }}
{% endif %} {% endif %}
{{ tox_extra_args }} {{ tox_extra_args }}
# Note: This intentionally ignores errors to give us the chance to look
# for file comments in the stdout. In case of an error this will be returned
# in a later task.
ignore_errors: yes
register: tox_output register: tox_output
- name: Look for output # Even though any test environment in tox failed we want to
# return file comments produced so always run this.
always:
- name: Look for output
tox_parse_output: tox_parse_output:
tox_output: '{{ tox_output.stdout }}' tox_output: '{{ tox_output.stdout }}'
tox_envlist: '{{ tox_envlist }}' tox_envlist: '{{ tox_envlist }}'
workdir: '{{ zuul_work_dir }}' workdir: '{{ zuul_work_dir }}'
when: tox_inline_comments when: tox_inline_comments
register: file_comments register: file_comments
ignore_errors: yes 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