zuul-jobs/roles/upload-logs/tasks/main.yaml
Monty Taylor 97d5602faa
Split the log_path creation into its own role
This is so that we can call it in the pre playbook for emitting info.
As part of doing this, use include_role to run it from upload-logs as it
always wants to be used there.

Change-Id: Ibd7d6bdb6275d052bcef2af068882e9b2876ef83
2017-09-06 18:57:41 -05:00

38 lines
928 B
YAML

- include_role:
name: generate-log-url
- name: Create log directories
file:
path: "{{zuul_logserver_root}}/{{ log_path }}"
state: directory
recurse: yes
mode: 0775
- name: Upload logs to log server
synchronize:
src: "{{ zuul.executor.log_root }}/"
dest: "{{zuul_logserver_root}}/{{ log_path }}/"
rsync_opts:
- "--exclude=job-output.txt"
no_log: true
# After this point there are no more logs
- name: gzip console log
delegate_to: localhost
archive:
path: "{{ zuul.executor.log_root }}/job-output.txt"
- name: Upload console log
synchronize:
src: "{{ zuul.executor.log_root }}/job-output.txt.gz"
dest: "{{zuul_logserver_root}}/{{ log_path }}/job-output.txt.gz"
verify_host: true
- name: Return log URL to Zuul
delegate_to: localhost
zuul_return:
data:
zuul:
log_url: "{{ zuul_log_url }}/{{ log_path }}/"
when: zuul_log_url is defined