Add overcloud deployment job

Adds a Zuul job to perform deployment of an OpenStack control plane
consisting of a single node. Currently no tests are run against the
resulting control plane.

Change-Id: I2728421cb5dbd1dc370a3aa7d37d913c90ba38a5
Story: #2001655
Task: #6682
This commit is contained in:
Mark Goddard
2018-03-12 12:35:00 +00:00
parent cff7a0f1bc
commit 4cdf71f5a1
15 changed files with 240 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
==================
Kayobe Diagnostics
==================
Ansible role to collect diagnostic information following a CI job performing
integration testing.

View File

@@ -0,0 +1,9 @@
---
# Job phase - one of 'pre' or 'post'.
kayobe_diagnostics_phase:
# Directory on the remote host in which to save diagnostics.
kayobe_diagnostics_logs_dir:
# Directory on the executor in which to save logs.
kayobe_diagnostics_executor_log_dir:

View File

@@ -0,0 +1,69 @@
#!/bin/bash
# NOTE(mgoddard): This has been adapted from tests/get_logs.sh in Kolla
# Ansible.
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
cp -rvnL /var/log/* ${LOG_DIR}/system_logs/
if [[ -x "$(command -v journalctl)" ]]; then
journalctl --no-pager > ${LOG_DIR}/system_logs/syslog.txt
journalctl --no-pager -u docker.service > ${LOG_DIR}/system_logs/docker.log
else
cp /var/log/upstart/docker.log ${LOG_DIR}/system_logs/docker.log
fi
cp -r /etc/sudoers.d ${LOG_DIR}/system_logs/
cp /etc/sudoers ${LOG_DIR}/system_logs/sudoers.txt
df -h > ${LOG_DIR}/system_logs/df.txt
free > ${LOG_DIR}/system_logs/free.txt
parted -l > ${LOG_DIR}/system_logs/parted-l.txt
mount > ${LOG_DIR}/system_logs/mount.txt
env > ${LOG_DIR}/system_logs/env.txt
if [ `command -v dpkg` ]; then
dpkg -l > ${LOG_DIR}/system_logs/dpkg-l.txt
fi
if [ `command -v rpm` ]; then
rpm -qa > ${LOG_DIR}/system_logs/rpm-qa.txt
fi
# final memory usage and process list
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ${LOG_DIR}/system_logs/ps.txt
# docker related information
(docker info && docker images && docker ps -a) > ${LOG_DIR}/system_logs/docker-info.txt
for container in $(docker ps -a --format "{{.Names}}"); do
docker logs --tail all ${container} > ${LOG_DIR}/docker_logs/${container}.txt
done
# Rename files to .txt; this is so that when displayed via
# logs.openstack.org clicking results in the browser shows the
# files, rather than trying to send it to another app or make you
# download it, etc.
# Rename files to .txt; this is so that when displayed via
# logs.openstack.org clicking results in the browser shows the
# files, rather than trying to send it to another app or make you
# download it, etc.
# Rename all .log files to .txt files
for f in $(find ${LOG_DIR}/{system_logs,kolla,docker_logs} -name "*.log"); do
mv $f ${f/.log/.txt}
done
chmod -R 777 ${LOG_DIR}
find ${LOG_DIR}/{system_logs,kolla,docker_logs} -iname '*.txt' -execdir gzip -f -9 {} \+
find ${LOG_DIR}/{system_logs,kolla,docker_logs} -iname '*.json' -execdir gzip -f -9 {} \+
}
copy_logs

View File

@@ -0,0 +1,2 @@
---
- include: "{{ kayobe_diagnostics_phase }}.yml"

View File

@@ -0,0 +1,21 @@
---
- name: Write host variables to a file
copy:
content: "{{ hostvars[inventory_hostname] | to_nice_json }}"
dest: "{{ kayobe_diagnostics_log_dir }}/facts.json"
- name: Run diagnostics script
script: get_logs.sh
register: get_logs_result
become: true
failed_when: false
- name: Print get_logs.sh output
debug:
msg: "{{ get_logs_result.stdout }}"
- name: Download logs to executor
synchronize:
src: "{{ kayobe_diagnostics_log_dir }}"
dest: "{{ kayobe_diagnostics_executor_log_dir }}/"
mode: pull

View File

@@ -0,0 +1,17 @@
---
- name: Ensure node log directory exists
file:
path: "{{ kayobe_diagnostics_log_dir }}"
state: "directory"
- name: Ensure node log subdirectories exist
file:
path: "{{ kayobe_diagnostics_log_dir }}/{{ item }}"
state: "directory"
mode: 0777
with_items:
- "docker_logs"
- "kolla_configs"
- "system_logs"
- "kolla"
- "ansible"