From a8608acb85c509c5809303239aefbf7b9fe1dd92 Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Mon, 13 Aug 2018 14:14:58 +0300 Subject: [PATCH 01/11] Configure cronjob Configure cronjob per (dev/test) environment. Default to do not configure cron. --- defaults/main.yml | 1 + tasks/tempest_verifiers.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 219df56..244fd4e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -59,6 +59,7 @@ clouds: {} # https_proxy: proxy_server_address_port configure_tempest: true +configure_tempest_cron: false # Where to take tempest from, and which version to use tempest_source: https://git.openstack.org/openstack/tempest diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 04cbf2f..231373d 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -79,6 +79,21 @@ - name: Template in tempest run bash script template: src=tempest_run.sh.j2 dest=/home/rally//{{ item.key }}-tempest_run.sh owner=rally group=rally mode=0700 + - name: Cron - Exclude production environments + set_fact: + clouds_devtest: "{{ clouds_devtest | combine({item.key: item.value}) }}" + when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" + with_dict: "{{ clouds }}" + + - name: Cron - Configure cronjob for deployment {{ item.key }} + cron: + name: "Run rally" + hour: "{{ rally_cron_run_hour }}" + job: "bash /home/rally//{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" + when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" + with_items: + - {{ clouds_devtest }} + become_user: rally environment: ftp_proxy: "" From b6cef8b7b3de6fbb1fc1b817ac3c881cbcb015db Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Mon, 13 Aug 2018 14:20:38 +0300 Subject: [PATCH 02/11] Change cron naming to use tempest --- tasks/tempest_verifiers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 231373d..6e2c3b3 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -88,7 +88,7 @@ - name: Cron - Configure cronjob for deployment {{ item.key }} cron: name: "Run rally" - hour: "{{ rally_cron_run_hour }}" + hour: "{{ tempest_cron_run_hour }}" job: "bash /home/rally//{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" with_items: From 7dfc16a273e639db0e75b904d8c583e23857a17b Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Mon, 13 Aug 2018 14:24:31 +0300 Subject: [PATCH 03/11] Point to rally's crontab --- tasks/tempest_verifiers.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 6e2c3b3..56ad658 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -88,8 +88,9 @@ - name: Cron - Configure cronjob for deployment {{ item.key }} cron: name: "Run rally" + user: rally hour: "{{ tempest_cron_run_hour }}" - job: "bash /home/rally//{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" + job: "bash /home/rally/{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" with_items: - {{ clouds_devtest }} From c3c1be92462c55bc2cd3b391f469bbf16cfc4af5 Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Mon, 13 Aug 2018 14:27:35 +0300 Subject: [PATCH 04/11] Add missing quotes --- tasks/tempest_verifiers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 56ad658..b5d6f80 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -85,7 +85,7 @@ when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" with_dict: "{{ clouds }}" - - name: Cron - Configure cronjob for deployment {{ item.key }} + - name: "Cron - Configure cronjob for deployment {{ item.key }}" cron: name: "Run rally" user: rally @@ -93,7 +93,7 @@ job: "bash /home/rally/{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" with_items: - - {{ clouds_devtest }} + - "{{ clouds_devtest }}" become_user: rally environment: From 43095c5dc05f10464aaf9793ec7c4834b36ddc3e Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Mon, 13 Aug 2018 15:36:32 +0300 Subject: [PATCH 05/11] Exclude prod in a simpler way --- tasks/tempest_verifiers.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index b5d6f80..b75ee5a 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -79,21 +79,13 @@ - name: Template in tempest run bash script template: src=tempest_run.sh.j2 dest=/home/rally//{{ item.key }}-tempest_run.sh owner=rally group=rally mode=0700 - - name: Cron - Exclude production environments - set_fact: - clouds_devtest: "{{ clouds_devtest | combine({item.key: item.value}) }}" - when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" - with_dict: "{{ clouds }}" - - - name: "Cron - Configure cronjob for deployment {{ item.key }}" + - name: "Configure cronjob for deployment {{ item.key }}" cron: - name: "Run rally" + name: "Run tempest against {{ item.key }}" user: rally - hour: "{{ tempest_cron_run_hour }}" + hour: "{{ item.value.tempest_cron_run_hour }}" job: "bash /home/rally/{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" - when: "configure_tempest_cron and {{ item.key not in ['cpouta-prod', 'epouta-prod'] }}" - with_items: - - "{{ clouds_devtest }}" + when: item.value.configure_tempest_cron become_user: rally environment: From 7beb47f2b94492920941398541107913f8998e1f Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Mon, 13 Aug 2018 15:40:00 +0300 Subject: [PATCH 06/11] Change single quotes to double quotes --- tasks/tempest_verifiers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index b75ee5a..7b977ca 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -84,7 +84,7 @@ name: "Run tempest against {{ item.key }}" user: rally hour: "{{ item.value.tempest_cron_run_hour }}" - job: "bash /home/rally/{{ item.key }}-tempest_run.sh --tag 'CRON_$(date +%Y_%m_%d_%H)'" + job: "bash /home/rally/{{ item.key }}-tempest_run.sh --tag \"CRON_$(date +%Y_%m_%d_%H)\"" when: item.value.configure_tempest_cron become_user: rally From 8b0659d0edef1f33c01b530743fa43d49df30bf8 Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Tue, 14 Aug 2018 15:35:06 +0300 Subject: [PATCH 07/11] Escape percentages And pin to full hour --- tasks/tempest_verifiers.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 7b977ca..16ceb28 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -84,7 +84,8 @@ name: "Run tempest against {{ item.key }}" user: rally hour: "{{ item.value.tempest_cron_run_hour }}" - job: "bash /home/rally/{{ item.key }}-tempest_run.sh --tag \"CRON_$(date +%Y_%m_%d_%H)\"" + minute: 0 + job: "/home/rally/{{ item.key }}-tempest_run.sh --tag CRON_$(date +\%Y_\%m_\%d_\%H)" when: item.value.configure_tempest_cron become_user: rally From 264cfeb3a4a989281692734cd6a476562559370d Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Tue, 14 Aug 2018 15:44:46 +0300 Subject: [PATCH 08/11] Store timestamp in variable --- tasks/tempest_verifiers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 16ceb28..ce1ca74 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -85,7 +85,7 @@ user: rally hour: "{{ item.value.tempest_cron_run_hour }}" minute: 0 - job: "/home/rally/{{ item.key }}-tempest_run.sh --tag CRON_$(date +\%Y_\%m_\%d_\%H)" + job: "RUN_TAG=$(date +\%Y_\%m_\%d_\%H); /home/rally/{{ item.key }}-tempest_run.sh --tag $RUN_TAG" when: item.value.configure_tempest_cron become_user: rally From e9aed856a58043527eae33b95fe8e583315070e8 Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Tue, 14 Aug 2018 16:01:01 +0300 Subject: [PATCH 09/11] Let's just not quote the darn thing --- tasks/tempest_verifiers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index ce1ca74..195a304 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -85,7 +85,7 @@ user: rally hour: "{{ item.value.tempest_cron_run_hour }}" minute: 0 - job: "RUN_TAG=$(date +\%Y_\%m_\%d_\%H); /home/rally/{{ item.key }}-tempest_run.sh --tag $RUN_TAG" + job: /home/rally/{{ item.key }}-tempest_run.sh --tag cron_$(date +\%Y_\%m_\%d_\%H) when: item.value.configure_tempest_cron become_user: rally From c432cabe2a8917152c4cbc0a5cd99826b0987d4d Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Tue, 14 Aug 2018 16:04:43 +0300 Subject: [PATCH 10/11] Don't provide a default This won't work anyway with the way stuff is currently picked up from the dict. --- defaults/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 244fd4e..219df56 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -59,7 +59,6 @@ clouds: {} # https_proxy: proxy_server_address_port configure_tempest: true -configure_tempest_cron: false # Where to take tempest from, and which version to use tempest_source: https://git.openstack.org/openstack/tempest From d901e92802cf8cce4484934274fc51ab74f347da Mon Sep 17 00:00:00 2001 From: Jukka Nousiainen Date: Wed, 15 Aug 2018 07:56:35 +0300 Subject: [PATCH 11/11] Default to not configuring cron --- tasks/tempest_verifiers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/tempest_verifiers.yml b/tasks/tempest_verifiers.yml index 195a304..987e050 100644 --- a/tasks/tempest_verifiers.yml +++ b/tasks/tempest_verifiers.yml @@ -86,7 +86,7 @@ hour: "{{ item.value.tempest_cron_run_hour }}" minute: 0 job: /home/rally/{{ item.key }}-tempest_run.sh --tag cron_$(date +\%Y_\%m_\%d_\%H) - when: item.value.configure_tempest_cron + when: item.value.configure_tempest_cron | default('false') become_user: rally environment: