Add web-ext-lint job
Change-Id: I12018ea457599ba0dd611c05464f3c1dd14d0fba
diff --git a/playbooks/web-ext-lint/pre.yaml b/playbooks/web-ext-lint/pre.yaml
new file mode 100644
index 0000000..ccd2fad
--- /dev/null
+++ b/playbooks/web-ext-lint/pre.yaml
@@ -0,0 +1,4 @@
+- name: Ensure web-ext is installed
+ hosts: all
+ roles:
+ - ensure-web-ext
diff --git a/playbooks/web-ext-lint/run.yaml b/playbooks/web-ext-lint/run.yaml
new file mode 100644
index 0000000..40f022a
--- /dev/null
+++ b/playbooks/web-ext-lint/run.yaml
@@ -0,0 +1,4 @@
+- hosts: all
+ roles:
+ - revoke-sudo
+ - web-ext-lint
diff --git a/roles/ensure-web-ext/tasks/main.yaml b/roles/ensure-web-ext/tasks/main.yaml
new file mode 100644
index 0000000..6a9f0e3
--- /dev/null
+++ b/roles/ensure-web-ext/tasks/main.yaml
@@ -0,0 +1,7 @@
+- name: Ensure NodeJS is installed
+ include_role:
+ name: ensure-nodejs
+ vars:
+ node_version: 14
+- name: Install web-ext
+ command: "npm install --global web-ext"
diff --git a/roles/web-ext-lint/defaults/main.yaml b/roles/web-ext-lint/defaults/main.yaml
new file mode 100644
index 0000000..5dc93b5
--- /dev/null
+++ b/roles/web-ext-lint/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+source_dir: src
+extra_lint_flags:
diff --git a/roles/web-ext-lint/tasks/main.yaml b/roles/web-ext-lint/tasks/main.yaml
new file mode 100644
index 0000000..62cf135
--- /dev/null
+++ b/roles/web-ext-lint/tasks/main.yaml
@@ -0,0 +1,7 @@
+- 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 }}
+ chdir: "{{ zuul.project.src_dir }}"
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
new file mode 100644
index 0000000..3db16ba
--- /dev/null
+++ b/zuul.d/jobs.yaml
@@ -0,0 +1,4 @@
+- job:
+ name: web-ext-lint
+ pre-run: playbooks/web-ext-lint/pre.yaml
+ run: playbooks/web-ext-lint/run.yaml