From 550e5da4b44f725c5b00dac6617f35ab8c7e7d57 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Thu, 10 May 2018 18:16:47 -0400 Subject: [PATCH] Allow upload-logs to toggle compression of console logs We should make it easy for users to view console logs by default. Today, we compress and upload logs and by default apache / nginx will not properly display them as plain text. This commit changes the default to not compress, but allows more advanced users to enable this logic. As mostly likley it also means additional configuration for your web server. Change-Id: Ic446db4f85e2098db8fa4568f8c5140ba564e931 Signed-off-by: Paul Belanger --- roles/upload-logs/README.rst | 7 +++++++ roles/upload-logs/tasks/main.yaml | 14 +++++++++++++- roles/upload-logs/vars/main.yaml | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/roles/upload-logs/README.rst b/roles/upload-logs/README.rst index 7df56e370..26c4689c0 100644 --- a/roles/upload-logs/README.rst +++ b/roles/upload-logs/README.rst @@ -29,6 +29,13 @@ description of the site_logs secret in this example post-run playbook: The root path to the logs on the logserver. +.. zuul:rolevar:: zuul_log_compress + :default: false + + When enabled, the console logs Zuul produces will be compressed + before uploading. You may need additional configuration for your web + server to view these files. + .. zuul:rolevar:: zuul_log_verbose :default: false diff --git a/roles/upload-logs/tasks/main.yaml b/roles/upload-logs/tasks/main.yaml index cd2b46a4c..e692f995a 100644 --- a/roles/upload-logs/tasks/main.yaml +++ b/roles/upload-logs/tasks/main.yaml @@ -40,8 +40,9 @@ with_items: - job-output.txt - job-output.json + when: zuul_log_compress | bool - - name: Upload console log and json output + - name: Upload compressed console log and json output synchronize: src: "{{ zuul.executor.log_root }}/{{ item }}.gz" dest: "{{ zuul_logserver_root }}/{{ zuul_log_path }}/{{ item }}.gz" @@ -49,6 +50,17 @@ with_items: - job-output.txt - job-output.json + when: zuul_log_compress | bool + + - name: Upload console log and json output + synchronize: + src: "{{ zuul.executor.log_root }}/{{ item }}" + dest: "{{ zuul_logserver_root }}/{{ zuul_log_path }}/{{ item }}" + verify_host: true + with_items: + - job-output.txt + - job-output.json + when: not zuul_log_compress | bool - name: Return log URL to Zuul delegate_to: localhost diff --git a/roles/upload-logs/vars/main.yaml b/roles/upload-logs/vars/main.yaml index c3a3be79e..8848aeefa 100644 --- a/roles/upload-logs/vars/main.yaml +++ b/roles/upload-logs/vars/main.yaml @@ -1,2 +1,3 @@ zuul_logserver_root: /srv/static/logs +zuul_log_compress: false zuul_log_verbose: false