From 0ad99eb2672dae5beed5bf52ce652cb72254d84e Mon Sep 17 00:00:00 2001 From: Sagi Shnaidman Date: Wed, 27 Feb 2019 19:15:17 +0200 Subject: [PATCH] Use infra generation of ARA reports ARA reports are generated automatically in infra when they are in ara-report directory. Don't generate htmls in upstream jobs to save a space. Change-Id: I7aa81ae3b06878baeab471e340477ca8a20f8594 --- roles/collect-logs/defaults/main.yml | 1 + roles/collect-logs/tasks/publish.yml | 63 +++++++++++++++++----------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/roles/collect-logs/defaults/main.yml b/roles/collect-logs/defaults/main.yml index 5694d4111..5d455b8d7 100644 --- a/roles/collect-logs/defaults/main.yml +++ b/roles/collect-logs/defaults/main.yml @@ -211,3 +211,4 @@ influxdb_create_data_file: true odl_extra_log_dir: /var/log/extra/odl odl_extra_info_log: "{{ odl_extra_log_dir }}/odl_info.log" ara_overcloud_db_path: "/var/lib/mistral/overcloud/ara_overcloud.sqlite" +ara_generate_html: true diff --git a/roles/collect-logs/tasks/publish.yml b/roles/collect-logs/tasks/publish.yml index b5f3a48c0..b13245f21 100644 --- a/roles/collect-logs/tasks/publish.yml +++ b/roles/collect-logs/tasks/publish.yml @@ -15,33 +15,48 @@ | gzip > {{ artcl_collect_dir }}/console.txt.gz when: lookup('env', 'BUILD_URL') != "" -- name: Generate and retrieve the ARA static playbook report - shell: > - {{ local_working_dir }}/bin/ara generate html {{ local_working_dir }}/ara_oooq; - {{ local_working_dir }}/bin/ara task list --all -f json > {{ artcl_collect_dir }}/ara.json; - cp -r {{ local_working_dir }}/ara_oooq {{ artcl_collect_dir }}/; - {% if artcl_gzip_only|bool %}gzip --best --recursive {{ artcl_collect_dir }}/ara_oooq;{% endif %} - ignore_errors: true +- when: ara_generate_html|bool + block: -- name: Generate and retrieve root the ARA static playbook report - become: true - shell: > - {{ local_working_dir }}/bin/ara generate html {{ local_working_dir }}/ara_oooq_root; - {{ local_working_dir }}/bin/ara task list --all -f json > {{ artcl_collect_dir }}/ara.oooq.root.json; - cp -r {{ local_working_dir }}/ara_oooq_root {{ artcl_collect_dir }}/; - {% if artcl_gzip_only|bool %}gzip --best --recursive {{ artcl_collect_dir }}/ara_oooq_root;{% endif %} - ignore_errors: true + - name: Generate and retrieve the ARA static playbook report + shell: > + {{ local_working_dir }}/bin/ara generate html {{ local_working_dir }}/ara_oooq; + {{ local_working_dir }}/bin/ara task list --all -f json > {{ artcl_collect_dir }}/ara.json; + cp -r {{ local_working_dir }}/ara_oooq {{ artcl_collect_dir }}/; + {% if artcl_gzip_only|bool %}gzip --best --recursive {{ artcl_collect_dir }}/ara_oooq;{% endif %} + ignore_errors: true -- name: Generate and retrieve the ARA static playbook report for OC deploy - become: true - shell: > - {{ local_working_dir }}/bin/ara generate html {{ local_working_dir }}/ara_oooq_oc; - {{ local_working_dir }}/bin/ara task list --all -f json > {{ artcl_collect_dir }}/ara.oooq.oc.json; - cp -r {{ local_working_dir }}/ara_oooq_oc {{ artcl_collect_dir }}/; - {% if artcl_gzip_only|bool %}gzip --best --recursive {{ artcl_collect_dir }}/ara_oooq_oc;{% endif %} + - name: Generate and retrieve root the ARA static playbook report + become: true + shell: > + {{ local_working_dir }}/bin/ara generate html {{ local_working_dir }}/ara_oooq_root; + {{ local_working_dir }}/bin/ara task list --all -f json > {{ artcl_collect_dir }}/ara.oooq.root.json; + cp -r {{ local_working_dir }}/ara_oooq_root {{ artcl_collect_dir }}/; + {% if artcl_gzip_only|bool %}gzip --best --recursive {{ artcl_collect_dir }}/ara_oooq_root;{% endif %} + ignore_errors: true + + - name: Generate and retrieve the ARA static playbook report for OC deploy + become: true + shell: > + {{ local_working_dir }}/bin/ara generate html {{ local_working_dir }}/ara_oooq_oc; + {{ local_working_dir }}/bin/ara task list --all -f json > {{ artcl_collect_dir }}/ara.oooq.oc.json; + cp -r {{ local_working_dir }}/ara_oooq_oc {{ artcl_collect_dir }}/; + {% if artcl_gzip_only|bool %}gzip --best --recursive {{ artcl_collect_dir }}/ara_oooq_oc;{% endif %} + ignore_errors: true + environment: + ARA_DATABASE: 'sqlite:///{{ ara_overcloud_db_path }}' + +- name: Copy ara files to ara-report directories + shell: | + mkdir -p {{ artcl_collect_dir }}/{{ item.dir }}/ara-report; + cp {{ item.file }} {{ artcl_collect_dir }}/{{ item.dir }}/ara-report/ansible.sqlite; + loop: + - dir: ara_oooq + file: "{{ local_working_dir }}/ara.sqlite" + - dir: ara_oooq_overcloud + file: "{{ ara_overcloud_db_path }}" ignore_errors: true - environment: - ARA_DATABASE: 'sqlite:///{{ ara_overcloud_db_path }}' + when: not ara_generate_html|bool - include: ara_graphite.yml when: ara_graphite_server is defined