From 1c4444bb7ef3dfb07d79a311154ca586ec5f8e8a Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Sun, 19 Aug 2018 20:56:56 -0400 Subject: [PATCH] Use new log collection process Change-Id: I97126c99e532d62695a18176ed6a1fc2e351b0da Signed-off-by: Paul Belanger --- tests/collect-logs.yaml | 45 +++++++++++++++++----------------------- tests/playbooks/pre.yaml | 6 ++++++ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tests/collect-logs.yaml b/tests/collect-logs.yaml index 901afcc..baccb33 100644 --- a/tests/collect-logs.yaml +++ b/tests/collect-logs.yaml @@ -1,24 +1,14 @@ - hosts: all tasks: - - name: Ensure logs directory exists - file: - path: "{{ item }}" - state: directory - with_items: - - "{{ zuul.executor.log_root }}/logs" - - "{{ zuul.executor.log_root }}/logs/var/log" - delegate_to: localhost - - name: Ensure journald logs directory exists file: - path: ~/logs/journal + path: "{{ zuul_output_dir }}/logs/logs/var/log/journal" state: directory - name: Collect journald logs - become: yes - shell: "journalctl -u {{ item }}.service > /home/{{ ansible_user }}/logs/journal/{{ item }}.service.log" + shell: "sudo journalctl -u {{ item }}.service | tee {{ zuul_output_dir }}/logs/logs/var/log/journal/{{ item }}.service.log" args: - creates: "/home/{{ ansible_user }}/logs/journal/{{ item }}.service.log" + creates: "{{ zuul_output_dir }}/logs/logs/var/log/journal/{{ item }}.service.log" with_items: - zuul-executor - zuul-fingergw @@ -26,22 +16,25 @@ - zuul-scheduler - zuul-web - - name: Collect journald log files + - name: Prepare zuul log files + become: yes synchronize: - dest: "{{ zuul.executor.log_root }}/logs/var/log" - mode: pull - src: ~/logs/journal - verify_host: true - - - name: Collect zuul log files - synchronize: - dest: "{{ zuul.executor.log_root }}/logs" - mode: pull - recursive: false + dest: "{{ zuul_output_dir }}/logs/logs" rsync_opts: - "--relative" + - "--chown={{ ansible_user_id }}:{{ ansible_user_id }}" src: "{{ item }}" verify_host: true + delegate_to: "{{ inventory_hostname }}" with_items: - - /etc/zuul/* - - /var/log/zuul/* + - /etc/zuul + - /var/log/zuul + + # TODO: Migrate to fetch-zuul-logs when + # https://review.openstack.org/#/c/583346/ is merged. + - name: Collect log output + synchronize: + dest: "{{ zuul.executor.log_root }}/" + mode: pull + src: "{{ zuul_output_dir }}/logs/" + verify_host: true diff --git a/tests/playbooks/pre.yaml b/tests/playbooks/pre.yaml index 9d6bf92..0dce620 100644 --- a/tests/playbooks/pre.yaml +++ b/tests/playbooks/pre.yaml @@ -14,6 +14,12 @@ --- - hosts: all tasks: + # TODO(pabelanger): Remove once this lands in our base job in + # project-config. + - name: Execute ensure-output-dirs role + include_role: + name: ensure-output-dirs + - name: Disable extra wheels mirror become: yes lineinfile: