From 3d02630d1b6fbcfc23057a1aa00b9a6217ea0078 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 25 Jan 2018 11:55:47 -0600 Subject: [PATCH] Add flag for turning off successful job logs As a relief valve for times of storage pressure on the receiving end, add a flag that can be set to skip log uploads for sucessful jobs. It uses the same logic as emit-ara-html. zuul_site_upload_logs == true (the default) will always upload logs zuul_site_upload_logs == false will never upload logs zuul_site_upload_logs == 'failure' will only upload failure logs Setting this variable should be done in site variables. Change-Id: I2a55730976520b75dcc98f86f34b7929f9243e62 --- roles/upload-logs/README.rst | 9 +++++++++ roles/upload-logs/tasks/main.yaml | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/roles/upload-logs/README.rst b/roles/upload-logs/README.rst index ecc45165d..98dcb43f8 100644 --- a/roles/upload-logs/README.rst +++ b/roles/upload-logs/README.rst @@ -12,3 +12,12 @@ This uploads logs to a static webserver using SSH. :default: /srv/static/logs The root path to the logs on the logserver. + +.. zuul:rolevar:: zuul_site_upload_logs + :default: true + + Controls when logs are uploaded. true, the default, means always upload + logs. false means never upload logs. 'failure' means to only upload logs + when the job has failed. + + .. note:: Intended to be set by admins via site-variables. diff --git a/roles/upload-logs/tasks/main.yaml b/roles/upload-logs/tasks/main.yaml index 11a8abb06..661ce9aec 100644 --- a/roles/upload-logs/tasks/main.yaml +++ b/roles/upload-logs/tasks/main.yaml @@ -2,9 +2,9 @@ include_role: name: set-zuul-log-path-fact -# NOTE(mordred) Temporary hack to only upload logs on failures to work around -# unfortunately timed disk outage. -- when: not zuul_success|bool +# Always upload (true), never upload (false) or only on failure ('failure') +- when: zuul_site_upload_logs | default(true) | bool or + (zuul_site_upload_logs == 'failure' and not zuul_success | bool) block: - name: Create log directories