From d594faf657896ebc8dd81aa362f37e1afb45cfe3 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 16 May 2018 19:11:40 +0100 Subject: [PATCH] Collect kayobe and kolla configuration in deployment CI jobs This can help in analysing failures. Change-Id: I9910f89fbeb5698a66659a835041dc564e2b64ae --- playbooks/kayobe-overcloud-base/post.yml | 1 + playbooks/kayobe-seed-base/post.yml | 1 + roles/kayobe-diagnostics/defaults/main.yml | 3 +++ roles/kayobe-diagnostics/files/get_logs.sh | 14 +++++++++++--- roles/kayobe-diagnostics/tasks/post.yml | 3 +++ roles/kayobe-diagnostics/tasks/pre.yml | 1 + 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/playbooks/kayobe-overcloud-base/post.yml b/playbooks/kayobe-overcloud-base/post.yml index 5de02240a..9970faca7 100644 --- a/playbooks/kayobe-overcloud-base/post.yml +++ b/playbooks/kayobe-overcloud-base/post.yml @@ -4,4 +4,5 @@ - role: kayobe-diagnostics kayobe_diagnostics_phase: "post" kayobe_diagnostics_log_dir: "/tmp/logs" + kayobe_diagnostics_config_dir: "{{ zuul.project.src_dir }}/config/src/kayobe-config" kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" diff --git a/playbooks/kayobe-seed-base/post.yml b/playbooks/kayobe-seed-base/post.yml index 5de02240a..9970faca7 100644 --- a/playbooks/kayobe-seed-base/post.yml +++ b/playbooks/kayobe-seed-base/post.yml @@ -4,4 +4,5 @@ - role: kayobe-diagnostics kayobe_diagnostics_phase: "post" kayobe_diagnostics_log_dir: "/tmp/logs" + kayobe_diagnostics_config_dir: "{{ zuul.project.src_dir }}/config/src/kayobe-config" kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" diff --git a/roles/kayobe-diagnostics/defaults/main.yml b/roles/kayobe-diagnostics/defaults/main.yml index 659ce2927..57a6b6ce2 100644 --- a/roles/kayobe-diagnostics/defaults/main.yml +++ b/roles/kayobe-diagnostics/defaults/main.yml @@ -5,5 +5,8 @@ kayobe_diagnostics_phase: # Directory on the remote host in which to save diagnostics. kayobe_diagnostics_logs_dir: +# Directory on the remote host in which configuration is stored. +kayobe_diagnostics_config_dir: + # Directory on the executor in which to save logs. kayobe_diagnostics_executor_log_dir: diff --git a/roles/kayobe-diagnostics/files/get_logs.sh b/roles/kayobe-diagnostics/files/get_logs.sh index 9408b012c..b8a16d29e 100644 --- a/roles/kayobe-diagnostics/files/get_logs.sh +++ b/roles/kayobe-diagnostics/files/get_logs.sh @@ -3,13 +3,21 @@ # NOTE(mgoddard): This has been adapted from tests/get_logs.sh in Kolla # Ansible. +# Environment variables: +# $LOG_DIR is the directory to copy logs to. +# $CONFIG_DIR is the directory to copy configuration from. + set +o errexit copy_logs() { - LOG_DIR=/tmp/logs - cp -rnL /var/lib/docker/volumes/kolla_logs/_data/* ${LOG_DIR}/kolla/ - # TODO(mgoddard): Copy kayobe config + if [[ -d ${CONFIG_DIR} ]]; then + cp -rnL ${CONFIG_DIR}/etc/kayobe/* ${LOG_DIR}/kayobe_configs + cp -rnL ${CONFIG_DIR}/etc/kolla/* ${LOG_DIR}/kolla_configs + # Don't save the IPA images. + rm ${LOG_DIR}/kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs} + rm ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs} + fi cp -rvnL /var/log/* ${LOG_DIR}/system_logs/ diff --git a/roles/kayobe-diagnostics/tasks/post.yml b/roles/kayobe-diagnostics/tasks/post.yml index 395e135f3..25efaa289 100644 --- a/roles/kayobe-diagnostics/tasks/post.yml +++ b/roles/kayobe-diagnostics/tasks/post.yml @@ -9,6 +9,9 @@ register: get_logs_result become: true failed_when: false + environment: + LOG_DIR: "{{ kayobe_diagnostics_log_dir }}" + CONFIG_DIR: "{{ kayobe_diagnostics_config_dir }}" - name: Print get_logs.sh output debug: diff --git a/roles/kayobe-diagnostics/tasks/pre.yml b/roles/kayobe-diagnostics/tasks/pre.yml index 6d51e6674..a4c567399 100644 --- a/roles/kayobe-diagnostics/tasks/pre.yml +++ b/roles/kayobe-diagnostics/tasks/pre.yml @@ -11,6 +11,7 @@ mode: 0777 with_items: - "docker_logs" + - "kayobe_configs" - "kolla_configs" - "system_logs" - "kolla"