go: Use 'block: ... always: ...' and failed_when instead of ignore_errors
Change-Id: I11fc6ec69eda00f4ac824f27712acc82ec445f79
This commit is contained in:
parent
b1b2dca456
commit
fff6843da0
@ -3,7 +3,7 @@
|
|||||||
register: go_installed_version
|
register: go_installed_version
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ ansible_env.PATH }}:{{ go_install_dir }}/go/bin"
|
PATH: "{{ ansible_env.PATH }}:{{ go_install_dir }}/go/bin"
|
||||||
ignore_errors: yes
|
failed_when: false
|
||||||
|
|
||||||
- name: Skip if correct version of go is installed
|
- name: Skip if correct version of go is installed
|
||||||
include_tasks: install-go.yaml
|
include_tasks: install-go.yaml
|
||||||
|
@ -1,27 +1,23 @@
|
|||||||
- name: Run golangci-lint
|
- block:
|
||||||
|
- name: Run golangci-lint
|
||||||
command: "golangci-lint run {{ golangci_lint_options }}"
|
command: "golangci-lint run {{ golangci_lint_options }}"
|
||||||
args:
|
args:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ ansible_env.PATH }}:{{ go_bin_path }}"
|
PATH: "{{ ansible_env.PATH }}:{{ go_bin_path }}"
|
||||||
ignore_errors: true
|
|
||||||
register: _golangci_lint
|
register: _golangci_lint
|
||||||
|
|
||||||
- name: Look for output
|
always:
|
||||||
|
- name: Look for output
|
||||||
golangci_lint_parse_output:
|
golangci_lint_parse_output:
|
||||||
workdir: '{{ zuul_work_dir }}'
|
workdir: '{{ zuul_work_dir }}'
|
||||||
output: '{{ _golangci_lint.stdout }}'
|
output: '{{ _golangci_lint.stdout }}'
|
||||||
register: _golangci_lint_parse_output
|
register: _golangci_lint_parse_output
|
||||||
|
|
||||||
- name: Return file comments to Zuul
|
- name: Return file comments to Zuul
|
||||||
when: _golangci_lint_parse_output.comments
|
when: _golangci_lint_parse_output.comments
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
zuul_return:
|
zuul_return:
|
||||||
data:
|
data:
|
||||||
zuul:
|
zuul:
|
||||||
file_comments: '{{ _golangci_lint_parse_output.comments }}'
|
file_comments: '{{ _golangci_lint_parse_output.comments }}'
|
||||||
|
|
||||||
- name: Return golangci-lint status
|
|
||||||
fail:
|
|
||||||
msg: 'golangci-lint exited with return code {{ _golangci_lint.rc }}'
|
|
||||||
when: _golangci_lint.rc != 0
|
|
||||||
|
Loading…
Reference in New Issue
Block a user