collect-logs: rename text files to txt.gz

Add the artcl_txt_rename option. When enabled, the publishing step
renames known text file extension to end in txt.gz which is directly
displayed by upstream log servers.

Also simplify the way we handle the stackviz and tempest results.

Change-Id: I793088995ca5a945738c5b04c1cefdd974e5f2d1
This commit is contained in:
Attila Darazs 2017-01-11 17:48:57 +01:00
parent 1bb2e31ed8
commit 43cb68c37c
4 changed files with 24 additions and 34 deletions

View File

@ -77,6 +77,9 @@ artcl_create_docs_payload:
to the target specified by `artcl_rsync_url`. Uses `BUILD_URL`, `BUILD_TAG` to the target specified by `artcl_rsync_url`. Uses `BUILD_URL`, `BUILD_TAG`
vars from the environment (set during a Jenkins job run) and requires the vars from the environment (set during a Jenkins job run) and requires the
next to variables to be set. next to variables to be set.
* `artcl_txt_rename`: false/true -- rename text based file to end in .txt.gz to
make upstream log servers display them in the browser instead of offering
them to download
* `artcl_publish_timeout`: the maximum seconds the role can spend uploading the * `artcl_publish_timeout`: the maximum seconds the role can spend uploading the
logs, the default is 1800 (30 minutes) logs, the default is 1800 (30 minutes)
* `artcl_use_rsync`: false/true -- use rsync to upload the logs * `artcl_use_rsync`: false/true -- use rsync to upload the logs

View File

@ -37,8 +37,10 @@ artcl_gzip_only: true
## publishing related vars ## publishing related vars
artcl_publish: false artcl_publish: false
artcl_txt_rename: false
# give up log upload after 30 minutes # give up log upload after 30 minutes
artcl_publish_timeout: 1800 artcl_publish_timeout: 1800
artcl_artifact_url: "file://{{ lookup('env', 'PWD') }}"
artcl_full_artifact_url: "{{ artcl_artifact_url }}/{{ lookup('env', 'BUILD_TAG') }}/" artcl_full_artifact_url: "{{ artcl_artifact_url }}/{{ lookup('env', 'BUILD_TAG') }}/"
artcl_use_rsync: false artcl_use_rsync: false
artcl_rsync_use_daemon: false artcl_rsync_use_daemon: false

View File

@ -210,37 +210,3 @@
file: file:
path: "{{ artcl_collect_dir }}/{{ inventory_hostname }}.tar" path: "{{ artcl_collect_dir }}/{{ inventory_hostname }}.tar"
state: absent state: absent
- name: Check for stackviz report data
stat: path="{{ artcl_collect_dir }}/undercloud/var/log/extra/stackviz/data"
register: stackviz
- name: Copy stackviz to root level
command: cp -r "{{ artcl_collect_dir }}/undercloud/var/log/extra/stackviz/" {{ artcl_collect_dir }}/stackviz
when: stackviz.stat.exists
- name: Unzip stackviz files
command: gzip -d -r "{{ artcl_collect_dir }}/stackviz"
when: stackviz.stat.exists
# Collect the tempest artifacts for reporting
- name: check for tempest html results
stat: path="{{ artcl_collect_dir }}/undercloud/home/stack/tempest/tempest.html.gz"
register: st_tempest_html
- name: unzip the tempest html file
command: gzip -d "{{ artcl_collect_dir }}/undercloud/home/stack/tempest/tempest.html.gz"
when: st_tempest_html.stat.exists
- name: check for tempest xml results
stat: path="{{ artcl_collect_dir }}/undercloud/home/stack/tempest/tempest.xml.gz"
register: st_tempest_xml
- name: unzip the tempest xml file
command: gzip -d "{{ artcl_collect_dir }}/undercloud/home/stack/tempest/tempest.xml.gz"
when: st_tempest_xml.stat.exists
- name: Copy the tempest html to the base dir of the logs
command: cp -r "{{ artcl_collect_dir }}/undercloud/home/stack/tempest/tempest.html" {{ artcl_collect_dir }}/tempest.html
when: st_tempest_html.stat.exists

View File

@ -13,6 +13,25 @@
command: cp -a {{ local_working_dir }}/ara {{ artcl_collect_dir }}/ara command: cp -a {{ local_working_dir }}/ara {{ artcl_collect_dir }}/ara
ignore_errors: "yes" ignore_errors: "yes"
- name: fetch stackviz results to the root of the collect_dir
shell: >
if [ -d {{ artcl_collect_dir }}/undercloud/var/log/extra/stackviz/data ]; then
cp -r {{ artcl_collect_dir }}/undercloud/var/log/extra/stackviz {{ artcl_collect_dir }};
gunzip -r {{ artcl_collect_dir }}/stackviz;
fi;
- name: fetch tempest results to the root of the collect_dir
shell: >
cp {{ artcl_collect_dir }}/undercloud/home/stack/tempest/tempest.{xml,html}{,.gz} {{ artcl_collect_dir }} || true;
gunzip {{ artcl_collect_dir }}/tempest.{xml,html}.gz || true;
- name: Rename text based files to end with txt.gz extension
shell: >
find {{ artcl_collect_dir }} -type f |
awk '/\.(conf|ini|json|sh|log|yaml|yml)\.gz$/ {
renamed=$0; sub(/\.gz$/, ".txt.gz", renamed); system("mv " $0 " " renamed) }';
when: artcl_txt_rename|bool
- name: upload to the artifact server using pubkey auth - name: upload to the artifact server using pubkey auth
shell: rsync -av --quiet -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" {{ artcl_collect_dir }}/ {{ artcl_rsync_path }}/{{ lookup('env', 'BUILD_TAG') }} shell: rsync -av --quiet -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" {{ artcl_collect_dir }}/ {{ artcl_rsync_path }}/{{ lookup('env', 'BUILD_TAG') }}
async: "{{ artcl_publish_timeout }}" async: "{{ artcl_publish_timeout }}"