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
This commit is contained in:
Monty Taylor 2018-01-25 11:55:47 -06:00
parent c999f9325f
commit 3d02630d1b
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 12 additions and 3 deletions

View File

@ -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.

View File

@ -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