From 09afa5ce5ff2bbaff97142f025fc0076c9431d1d Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 4 Dec 2015 18:46:23 -0800 Subject: [PATCH] add a check-compose role and activate it on openqa servers I just killed the old BOS openqa deployment, which sends out those 'compose check' emails, so I'm gonna go ahead and have this new openqa deployment start sending out those emails a little earlier than planned. This should result in both prod and staging openqa running a compose check each day, but only prod should actually send out an email report. --- inventory/group_vars/openqa | 4 +- playbooks/groups/openqa.yml | 1 + roles/check-compose/tasks/main.yml | 70 +++++++++++++++++++ .../templates/check-compose.conf.j2 | 13 ++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 roles/check-compose/tasks/main.yml create mode 100644 roles/check-compose/templates/check-compose.conf.j2 diff --git a/inventory/group_vars/openqa b/inventory/group_vars/openqa index 43fa379530..a7f54cea77 100644 --- a/inventory/group_vars/openqa +++ b/inventory/group_vars/openqa @@ -17,7 +17,9 @@ openqa_secret: "{{ prod_openqa_apisecret }}" wikitcms_user: coconut wikitcms_password: "{{ prod_wikitcms_password }}" -openqa_workers: 3 +check-compose_email-from: rawhide@fedoraproject.org +check-compose_email-to: "test@lists.fedoraproject.org devel@lists.fedoraproject.org" +check-compose_smtp: bastion.phx2.fedoraproject.org deployment_type: prod diff --git a/playbooks/groups/openqa.yml b/playbooks/groups/openqa.yml index a9b633a3e3..8072e3bd32 100644 --- a/playbooks/groups/openqa.yml +++ b/playbooks/groups/openqa.yml @@ -43,6 +43,7 @@ roles: - { role: openqa/server, tags: ['openqa_server'] } - { role: openqa/dispatcher, tags: ['openqa_dispatcher'] } + - { role: check-compose, tags: ['check-compose'] } handlers: - include: "{{ handlers }}/restart_services.yml" diff --git a/roles/check-compose/tasks/main.yml b/roles/check-compose/tasks/main.yml new file mode 100644 index 0000000000..203ba09768 --- /dev/null +++ b/roles/check-compose/tasks/main.yml @@ -0,0 +1,70 @@ +# Optional vars +# - check-compose_wait +## string - (digits) time in minutes to wait for openQA tests to complete +## before sending the report (defaults to 480) +# - check-compose_email-from +## string - Email address to send report from (if not set, no report sent) +# - check-compose_email-to +## string - Email address to send report to (if not set but email-from +## set, report will go to email-from, for testing usually) +## Split multiple addresses with spaces +# - check-compose_smtp +## string - SMTP server to use for sending the report +# - check-compose_json +## string - File to append JSON-formatted report summary to +# - check-compose_loglevel +## string - log level +# +# NOTE: this is missing /etc/openqa/client.conf configuration, for now; +# we're assuming it'll be deployed on the openqa server boxes and hence +# client.conf will be in place (and localhost default would be correct +# anyhow) + +- name: Install required packages + dnf: name={{ item }} state=present + with_items: + - fedfind + - python-six + tags: + - packages + +- name: Check out openQA-python-client + git: + repo: https://github.com/os-autoinst/openQA-python-client.git + dest: /root/openQA-python-client + register: gitclient + +- name: Check if python-client has ever been installed + command: "python -c 'import openqa_client'" + register: instclient + changed_when: "1 != 1" + failed_when: "1 != 1" + +- name: Install openQA-python-client + command: "python setup.py install" + args: + chdir: /root/openQA-python-client + when: "gitclient|changed or instclient.rc > 0" + +- name: Check out fedora-qa (where check-compose lives) + git: + repo: https://git.fedorahosted.org/git/fedora-qa.git + dest: /root/fedora-qa + register: gitqa + +- name: Install check-compose + command: "make install" + args: + chdir: /root/fedora-qa/check-compose + when: "gitqa|changed" + +- name: Install config file + template: src=check-compose.conf.j2 dest=/etc/check-compose.conf mode=0644 + tags: + - config + +- name: Enable and start timers + service: name=check-compose-{{ item }}.timer enabled=yes state=started + with_items: + - branched + - rawhide diff --git a/roles/check-compose/templates/check-compose.conf.j2 b/roles/check-compose/templates/check-compose.conf.j2 new file mode 100644 index 0000000000..d0a433f53f --- /dev/null +++ b/roles/check-compose/templates/check-compose.conf.j2 @@ -0,0 +1,13 @@ +[main] +{% if check-compose_wait is defined %} +wait: {{ check-compose_wait }} +{% if check-compose_email-from is defined %} +email-from: {{ check-compose_email-from }} +{% if check-compose_email-to is defined %} +email-to: {{ check-compose_email-to }} +{% if check-compose_smtp is defined %} +smtp: {{ check-compose_smtp }} +{% if check-compose_json is defined %} +json: {{ check-compose_json }} +{% if check-compose_loglevel is defined %} +loglevel: {{ check-compose_loglevel }}