Add web-ext-lint job report to the log folder

- Add fetch-web-ext-lint role, which copies the web-ext-lint report to
  the log folder.

Changes in the web-ext-lint job:
- Change the main playbook so the lint report is saved in a file called
  web-ext-lint.txt (so it can fetched later on).
- Add a post playbook which calls the fetch-web-ext-lint role.
- Add a description to the job.

Change-Id: Ifc2ef60084ecc33087e5ce2761ad91d84e7eff3c
diff --git a/playbooks/web-ext-lint/post.yaml b/playbooks/web-ext-lint/post.yaml
new file mode 100644
index 0000000..159ecf8
--- /dev/null
+++ b/playbooks/web-ext-lint/post.yaml
@@ -0,0 +1,4 @@
+- name: Get web-ext lint report
+  hosts: all
+  roles:
+    - fetch-web-ext-lint
diff --git a/roles/fetch-web-ext-lint/tasks/main.yaml b/roles/fetch-web-ext-lint/tasks/main.yaml
new file mode 100644
index 0000000..8a81b51
--- /dev/null
+++ b/roles/fetch-web-ext-lint/tasks/main.yaml
@@ -0,0 +1,14 @@
+- name: Is there a web-ext-lint.txt
+  register: stat_wel_txt
+  stat:
+    path: "{{ zuul.project.src_dir }}"
+
+- name: Store on executor
+  when: stat_wel_txt.stat.exists
+  synchronize:
+    mode: pull
+    src: "{{ zuul.project.src_dir }}/web-ext-lint.txt"
+    dest: "{{ zuul.executor.log_root }}/web-ext-lint.txt"
+    verify_host: true
+    owner: no
+    group: no
diff --git a/roles/web-ext-lint/tasks/main.yaml b/roles/web-ext-lint/tasks/main.yaml
index 62cf135..57b5b12 100644
--- a/roles/web-ext-lint/tasks/main.yaml
+++ b/roles/web-ext-lint/tasks/main.yaml
@@ -1,7 +1,11 @@
 - name: Run the web-ext linter
   shell:
-    cmd: >-
-      web-ext lint --no-input --boring
-      {{ '--source-dir=' + source_dir if source_dir else '' }}
-      {{ extra_lint_flags }}
+    cmd: |
+      set -o pipefail
+      set -e
+      web-ext lint --no-input --boring \
+          {{ '--source-dir=' + source_dir if source_dir else '' }} \
+          {{ extra_lint_flags }} | tee -a web-ext-lint.txt
     chdir: "{{ zuul.project.src_dir }}"
+    executable: /bin/bash
+  changed_when: false
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 3db16ba..26bc4e6 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -2,3 +2,5 @@
     name: web-ext-lint
     pre-run: playbooks/web-ext-lint/pre.yaml
     run: playbooks/web-ext-lint/run.yaml
+    post-run: playbooks/web-ext-lint/post.yaml
+    description: Check a Web Extension project for basic lint problems.