3d02630d1b
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
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
- name: Set zuul-log-path fact
|
|
include_role:
|
|
name: set-zuul-log-path-fact
|
|
|
|
# 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
|
|
file:
|
|
path: "{{zuul_logserver_root}}/{{ zuul_log_path }}"
|
|
state: directory
|
|
recurse: yes
|
|
mode: 0775
|
|
|
|
- name: Ensure logs are readable before uploading
|
|
delegate_to: localhost
|
|
file:
|
|
path: "{{ zuul.executor.log_root }}/"
|
|
mode: u=rwX,g=rX,o=rX
|
|
state: directory
|
|
recurse: yes
|
|
|
|
- name: Upload logs to log server
|
|
synchronize:
|
|
src: "{{ zuul.executor.log_root }}/"
|
|
dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/"
|
|
rsync_opts:
|
|
- "--exclude=job-output.txt"
|
|
- "--exclude=job-output.json"
|
|
no_log: true
|
|
|
|
# After this point there are no more logs
|
|
- name: gzip console log and json output
|
|
delegate_to: localhost
|
|
archive:
|
|
path: "{{ zuul.executor.log_root }}/{{ item }}"
|
|
with_items:
|
|
- job-output.txt
|
|
- 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
|
|
delegate_to: localhost
|
|
zuul_return:
|
|
data:
|
|
zuul:
|
|
log_url: "{{ zuul_log_url }}/{{ zuul_log_path }}/"
|
|
when: zuul_log_url is defined
|