Only upload logs when jobs fail

We're having some major disk issues. Help the situation by only
uploading failure logs.

Change-Id: I4156fb59570d98b16c775752639c2fe23e5777c5
This commit is contained in:
Monty Taylor 2018-01-25 09:02:47 -06:00
parent 6283695966
commit c999f9325f
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594

View File

@ -2,47 +2,52 @@
include_role: include_role:
name: set-zuul-log-path-fact name: set-zuul-log-path-fact
- name: Create log directories # NOTE(mordred) Temporary hack to only upload logs on failures to work around
file: # unfortunately timed disk outage.
path: "{{zuul_logserver_root}}/{{ zuul_log_path }}" - when: not zuul_success|bool
state: directory block:
recurse: yes
mode: 0775
- name: Ensure logs are readable before uploading - name: Create log directories
delegate_to: localhost file:
file: path: "{{zuul_logserver_root}}/{{ zuul_log_path }}"
path: "{{ zuul.executor.log_root }}/" state: directory
mode: u=rwX,g=rX,o=rX recurse: yes
state: directory mode: 0775
recurse: yes
- name: Upload logs to log server - name: Ensure logs are readable before uploading
synchronize: delegate_to: localhost
src: "{{ zuul.executor.log_root }}/" file:
dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/" path: "{{ zuul.executor.log_root }}/"
rsync_opts: mode: u=rwX,g=rX,o=rX
- "--exclude=job-output.txt" state: directory
- "--exclude=job-output.json" recurse: yes
no_log: true
# After this point there are no more logs - name: Upload logs to log server
- name: gzip console log and json output synchronize:
delegate_to: localhost src: "{{ zuul.executor.log_root }}/"
archive: dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/"
path: "{{ zuul.executor.log_root }}/{{ item }}" rsync_opts:
with_items: - "--exclude=job-output.txt"
- job-output.txt - "--exclude=job-output.json"
- job-output.json no_log: true
- name: Upload console log and json output # After this point there are no more logs
synchronize: - name: gzip console log and json output
src: "{{ zuul.executor.log_root }}/{{ item }}.gz" delegate_to: localhost
dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/{{ item }}.gz" archive:
verify_host: true path: "{{ zuul.executor.log_root }}/{{ item }}"
with_items: with_items:
- job-output.txt - job-output.txt
- job-output.json - job-output.json
- name: Upload console log and json output
synchronize:
src: "{{ zuul.executor.log_root }}/{{ item }}.gz"
dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/{{ item }}.gz"
verify_host: true
with_items:
- job-output.txt
- job-output.json
- name: Return log URL to Zuul - name: Return log URL to Zuul
delegate_to: localhost delegate_to: localhost