From 3d6cae8298681bcd532a59c44edc04142026bb3b Mon Sep 17 00:00:00 2001
From: Jeremy Stanley <fungi@yuggoth.org>
Date: Fri, 24 Jul 2020 17:54:15 +0000
Subject: [PATCH] Run ara-report on bridge in run-base-post

We can't run ARA on the executor because that involves running
arbitrary commands, instead generate reports on the executor and put
them where the normal fetch-output will find them later.

Change-Id: I20d88a7f03872d19f6bd014bc687a1bf16e4e80e
---
 playbooks/zuul/run-base-post.yaml | 46 ++++++++++++++-----------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/playbooks/zuul/run-base-post.yaml b/playbooks/zuul/run-base-post.yaml
index 17b5596006..4aebedaf95 100644
--- a/playbooks/zuul/run-base-post.yaml
+++ b/playbooks/zuul/run-base-post.yaml
@@ -7,13 +7,6 @@
         recurse: true
       loop: "{{ query('inventory_hostnames', 'all') }}"
 
-    - name: Ensure bridge ARA log directories exist
-      file:
-        path: "{{ item }}"
-        state: directory
-      with_items:
-        - "{{ zuul.executor.log_root }}/bridge.openstack.org/ara-report"
-
 - hosts: all
   tasks:
     - include_role:
@@ -50,15 +43,26 @@
         recurse: yes
       become: yes
 
-      # Note we convert to a HTML report with the ara-report role
-      # below
-    - name: Collect testing ARA results
-      synchronize:
-        dest: "{{ log_dir }}/ara-report/ansible.sqlite"
-        mode: pull
-        src: "/var/cache/ansible/ara.sqlite"
-        verify_host: true
-      ignore_errors: true
+    - name: Ensure ARA log directories exist
+      file:
+        path: "{{ item }}"
+        state: directory
+      with_items:
+        - "{{ ansible_user_dir }}/zuul-output/logs/ara-report"
+
+    - name: Copy ARA database into report dir
+      copy:
+        remote_src: true
+        src: /var/cache/ansible/ara.sqlite
+        dest: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/ara.sqlite"
+
+    - name: Create ARA report
+      include_role:
+        name: ara-report
+      vars:
+        ara_database_path: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/ara.sqlite"
+        ara_report_path: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/"
+        ara_report_type: html
 
     - name: Collect ansible configuration
       synchronize:
@@ -69,13 +73,3 @@
         rsync_opts:
           - "--exclude=__pycache__"
       ignore_errors: true
-
-- hosts: localhost
-  tasks:
-    - name: Create bridge.o.o ARA report
-      include_role:
-        name: ara-report
-      vars:
-        ara_database_path: "{{ zuul.executor.log_root }}/bridge.openstack.org/ara-report/ansible.sqlite"
-        ara_report_path: "bridge.openstack.org/ara-report/"
-        ara_report_type: html