Files
zuul-jobs/roles/tox/tasks/main.yaml
Monty Taylor e404589b84 Add flag for toggling inline comments for linters
Sometimes there are linters that are producing output where
people do not care about it enough to want to see it.

Change-Id: I0d58a3f6a4c51e1419b645a7ce1a81e6adee57d3
2020-04-01 09:01:06 -05:00

66 lines
1.8 KiB
YAML

- name: Require tox_envlist variable
fail:
msg: tox_envlist is required for this role
when: tox_envlist is not defined
- name: Check to see if the constraints file exists
stat:
path: "{{ tox_constraints_file }}"
get_checksum: false
get_mime: false
get_md5: false
register: stat_results
when: tox_constraints_file is defined
- name: Fail if constraints file is missing
when: tox_constraints_file is defined and not stat_results.stat.exists
fail:
msg: tox_constraints_file is defined but was not found
- name: Record file location
set_fact:
tox_constraints_env:
TOX_CONSTRAINTS_FILE: "{{ tox_constraints_file }}"
# Backward compatibility, to be removed
UPPER_CONSTRAINTS_FILE: "{{ tox_constraints_file }}"
when: tox_constraints_file is defined
- name: Install tox siblings
include: siblings.yaml
when: tox_install_siblings
- name: Emit tox command
debug:
msg: "Running tox: {{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}"
- name: Run tox
args:
chdir: "{{ zuul_work_dir }}"
environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
command: "{{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}"
failed_when: false
register: tox_output
- name: Look for output
tox_parse_output:
tox_output: '{{ tox_output.stdout }}'
when: tox_inline_comments
register: file_comments
ignore_errors: yes
- name: Return file comments to Zuul
when:
- file_comments
- file_comments.file_comments
delegate_to: localhost
zuul_return:
data:
zuul:
file_comments: '{{ file_comments.file_comments }}'
ignore_errors: yes
- name: Return tox status
fail:
msg: 'tox exited with return code {{ tox_output.rc }}'
when: tox_output.rc != 0