diff --git a/roles/ensure-go/tasks/main.yaml b/roles/ensure-go/tasks/main.yaml index e4936ec3d..2ce6f5ef3 100644 --- a/roles/ensure-go/tasks/main.yaml +++ b/roles/ensure-go/tasks/main.yaml @@ -3,7 +3,7 @@ register: go_installed_version environment: PATH: "{{ ansible_env.PATH }}:{{ go_install_dir }}/go/bin" - ignore_errors: yes + failed_when: false - name: Skip if correct version of go is installed include_tasks: install-go.yaml diff --git a/roles/golangci-lint/tasks/main.yaml b/roles/golangci-lint/tasks/main.yaml index 7f90a4598..1e55d3773 100644 --- a/roles/golangci-lint/tasks/main.yaml +++ b/roles/golangci-lint/tasks/main.yaml @@ -1,27 +1,23 @@ -- name: Run golangci-lint - command: "golangci-lint run {{ golangci_lint_options }}" - args: - chdir: "{{ zuul_work_dir }}" - environment: - PATH: "{{ ansible_env.PATH }}:{{ go_bin_path }}" - ignore_errors: true - register: _golangci_lint +- block: + - name: Run golangci-lint + command: "golangci-lint run {{ golangci_lint_options }}" + args: + chdir: "{{ zuul_work_dir }}" + environment: + PATH: "{{ ansible_env.PATH }}:{{ go_bin_path }}" + register: _golangci_lint -- name: Look for output - golangci_lint_parse_output: - workdir: '{{ zuul_work_dir }}' - output: '{{ _golangci_lint.stdout }}' - register: _golangci_lint_parse_output + always: + - name: Look for output + golangci_lint_parse_output: + workdir: '{{ zuul_work_dir }}' + output: '{{ _golangci_lint.stdout }}' + register: _golangci_lint_parse_output -- name: Return file comments to Zuul - when: _golangci_lint_parse_output.comments - delegate_to: localhost - zuul_return: - data: - zuul: - 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 + - name: Return file comments to Zuul + when: _golangci_lint_parse_output.comments + delegate_to: localhost + zuul_return: + data: + zuul: + file_comments: '{{ _golangci_lint_parse_output.comments }}'