aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/jenkins_job_health_exporter
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.ansible/roles/jenkins_job_health_exporter')
-rw-r--r--fdio.infra.ansible/roles/jenkins_job_health_exporter/defaults/main.yaml35
-rw-r--r--fdio.infra.ansible/roles/jenkins_job_health_exporter/handlers/main.yaml9
-rw-r--r--fdio.infra.ansible/roles/jenkins_job_health_exporter/tasks/main.yaml38
-rw-r--r--fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.j216
-rw-r--r--fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.service.j213
5 files changed, 111 insertions, 0 deletions
diff --git a/fdio.infra.ansible/roles/jenkins_job_health_exporter/defaults/main.yaml b/fdio.infra.ansible/roles/jenkins_job_health_exporter/defaults/main.yaml
new file mode 100644
index 0000000000..9813d41afb
--- /dev/null
+++ b/fdio.infra.ansible/roles/jenkins_job_health_exporter/defaults/main.yaml
@@ -0,0 +1,35 @@
+---
+# file: roles/jenkins_job_health_exporter/defaults/main.yaml
+
+# Conf - Jenkins Job Health Exporter.
+jenkins_host: "jenkins.fd.io"
+poll_interval_sec: 1800
+req_timeout_sec: 30
+bind_to: "0.0.0.0:9186"
+last_builds: 10
+jobs:
+ - "vpp-csit-verify-api-crc-master"
+ - "vpp-beta-verify-master-ubuntu2004-aarch64"
+ - "vpp-verify-master-centos8-aarch64"
+ - "vpp-verify-master-ubuntu1804-aarch64"
+ - "vpp-gcc-verify-master-ubuntu2004-x86_64"
+ - "vpp-verify-master-centos8-x86_64"
+ - "vpp-verify-master-debian10-x86_64"
+ - "vpp-verify-master-ubuntu2004-x86_64"
+ - "vpp-verify-master-ubuntu1804-x86_64"
+ - "vpp-debug-verify-master-ubuntu2004-x86_64"
+ - "vpp-checkstyle-verify-master-ubuntu2004-x86_64"
+ - "vpp-sphinx-docs-verify-master-ubuntu1804-x86_64"
+ - "vpp-docs-verify-master-ubuntu1804-x86_64"
+ - "vpp-make-test-docs-verify-master-ubuntu1804-x86_64"
+ - "vpp-csit-verify-device-master-1n-skx"
+ - "vpp-csit-verify-device-master-1n-tx2"
+
+# Conf - Service.
+jenkins_job_health_exporter_restart_handler_state: "restarted"
+
+# Inst - System paths.
+jenkins_job_health_exporter_target_dir: "/usr/bin"
+jenkins_job_health_exporter_conf_dir: "/etc"
+jenkins_job_health_exporter_url: "https://github.com/ayourtch/jenkins-job-health-exporter/releases/download"
+jenkins_job_health_exporter_version: "v0.0.3" \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/jenkins_job_health_exporter/handlers/main.yaml b/fdio.infra.ansible/roles/jenkins_job_health_exporter/handlers/main.yaml
new file mode 100644
index 0000000000..29fee98fed
--- /dev/null
+++ b/fdio.infra.ansible/roles/jenkins_job_health_exporter/handlers/main.yaml
@@ -0,0 +1,9 @@
+---
+# file roles/jenkins_job_health_exporter/handlers/main.yaml
+
+- name: Restart Jenkins Job Health Exporter
+ systemd:
+ daemon_reload: true
+ enabled: true
+ name: "jenkins-job-health-exporter"
+ state: "{{ jenkins_job_health_exporter_restart_handler_state }}"
diff --git a/fdio.infra.ansible/roles/jenkins_job_health_exporter/tasks/main.yaml b/fdio.infra.ansible/roles/jenkins_job_health_exporter/tasks/main.yaml
new file mode 100644
index 0000000000..5dbe476019
--- /dev/null
+++ b/fdio.infra.ansible/roles/jenkins_job_health_exporter/tasks/main.yaml
@@ -0,0 +1,38 @@
+---
+# file: roles/jenkins_job_health_exporter/tasks/main.yaml
+
+- name: Conf - Jenkins Job Health Exporter Config
+ template:
+ src: "templates/jenkins-job-health-exporter.j2"
+ dest: "/etc/jenkins-job-health-exporter.json"
+ owner: "root"
+ group: "root"
+ mode: "0644"
+ when:
+ - ansible_hostname == "s42-nomad"
+ tags:
+ - conf-jenkins-job-json
+
+- name: Inst - Jenkins Job Health Exporter Binary
+ get_url:
+ url: "{{ jenkins_job_health_exporter_url }}/{{ jenkins_job_health_exporter_version }}/jenkins-job-health-exporter"
+ dest: "{{ jenkins_job_health_exporter_target_dir }}/jenkins-job-health-exporter"
+ mode: "0755"
+ when:
+ - ansible_hostname == "s42-nomad"
+ tags:
+ - inst-jenkins-job-binary
+
+- name: Inst - Jenkins Job Health Exporter Service
+ template:
+ src: "templates/jenkins-job-health-exporter.service.j2"
+ dest: "/lib/systemd/system/jenkins-job-health-exporter.service"
+ owner: "root"
+ group: "root"
+ mode: "0644"
+ when:
+ - ansible_hostname == "s42-nomad"
+ notify:
+ - "Restart Jenkins Job Health Exporter"
+ tags:
+ - inst-jenkins-job-service
diff --git a/fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.j2 b/fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.j2
new file mode 100644
index 0000000000..5942b782e0
--- /dev/null
+++ b/fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.j2
@@ -0,0 +1,16 @@
+{
+ "jenkins_host": "{{ jenkins_host }}",
+ "poll_interval_sec": {{ poll_interval_sec }},
+ "req_timeout_sec": {{ req_timeout_sec }},
+ "bind_to": "{{ bind_to }}",
+ "last_builds": {{ last_builds }},
+ "jobs": [
+{% for item in jobs %}
+ "{{ item }}"
+{%- if not loop.last %},
+{% endif %}
+{% endfor %}
+
+ ],
+ "verbose": 3
+} \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.service.j2 b/fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.service.j2
new file mode 100644
index 0000000000..38073d0a8c
--- /dev/null
+++ b/fdio.infra.ansible/roles/jenkins_job_health_exporter/templates/jenkins-job-health-exporter.service.j2
@@ -0,0 +1,13 @@
+[Unit]
+Description=Jenkins Job Health Exporter
+Documentation=https://github.com/ayourtch/jenkins-job-health-exporter
+
+[Service]
+Restart=always
+ExecStart={{ jenkins_job_health_exporter_target_dir }}/jenkins-job-health-exporter {{ jenkins_job_health_exporter_conf_dir }}/jenkins-job-health-exporter.json
+ExecReload=/bin/kill -HUP $MAINPID
+TimeoutStopSec=20s
+SendSIGKILL=no
+
+[Install]
+WantedBy=multi-user.target \ No newline at end of file