Enable ARA reports for system-config bridge CI jobs

This change takes the ARA report from the "inner" run of the base
playbooks on our bridge.o.o node and publishes it into the final log
output.  This is then displayed by the middleware.

Create a new log hierarchy with a "bridge.o.o" to make it clear the
logs here are related to the test running on that node.  Move the
ansible config under there too.

Change-Id: I74122db09f0f712836a0ee820c6fac87c3c9c734
This commit is contained in:
Ian Wienand 2018-11-12 14:22:32 +11:00 committed by David Moreau Simard
parent 35e87d6879
commit 3bed6e0fd3
No known key found for this signature in database
GPG Key ID: CBEB466764A9E621
4 changed files with 51 additions and 1 deletions

View File

@ -127,6 +127,8 @@
pre-run: playbooks/zuul/run-base-pre.yaml pre-run: playbooks/zuul/run-base-pre.yaml
run: playbooks/zuul/run-base.yaml run: playbooks/zuul/run-base.yaml
post-run: playbooks/zuul/run-base-post.yaml post-run: playbooks/zuul/run-base-post.yaml
vars:
install_ansible_ara_enable: true
- job: - job:
name: system-config-run-base name: system-config-run-base
@ -166,11 +168,14 @@
- name: github.com/ansible/ansible - name: github.com/ansible/ansible
override-checkout: devel override-checkout: devel
- name: openstack/openstacksdk - name: openstack/openstacksdk
- name: openstack/ara
vars: vars:
bridge_ansible_name: '{{ ansible_user_dir}}/src/github.com/ansible/ansible' bridge_ansible_name: '{{ ansible_user_dir}}/src/github.com/ansible/ansible'
bridge_ansible_version: null bridge_ansible_version: null
bridge_openstacksdk_name: '{{ ansible_user_dir }}/src/git.openstack.org/openstack/openstacksdk' bridge_openstacksdk_name: '{{ ansible_user_dir }}/src/git.openstack.org/openstack/openstacksdk'
bridge_openstacksdk_version: null bridge_openstacksdk_version: null
bridge_ara_name: '{{ ansible_user_dir}}/src/git.openstack.org/openstack/ara'
bridge_ara_version: null
- job: - job:
name: system-config-run-eavesdrop name: system-config-run-eavesdrop

View File

@ -15,6 +15,11 @@
install_ansible_version: '{{ bridge_ansible_version | default("2.7.3") }}' install_ansible_version: '{{ bridge_ansible_version | default("2.7.3") }}'
install_ansible_openstacksdk_name: '{{ bridge_openstacksdk_name | default("openstacksdk") }}' install_ansible_openstacksdk_name: '{{ bridge_openstacksdk_name | default("openstacksdk") }}'
install_ansible_openstacksdk_version: '{{ bridge_openstacksdk_verison | default("latest") }}' install_ansible_openstacksdk_version: '{{ bridge_openstacksdk_verison | default("latest") }}'
# NOTE(ianw): At 2018-12, ARA is only enabled during gate
# testing jobs as we decide if or how to store data on
# production bridge.o.o
install_ansible_ara_name: '{{ bridge_ara_name | default("ara") }}'
install_ansible_ara_version: '{{ bridge_ara_version | default("0.16.1") }}'
- root-keys - root-keys
- ansible-cron - ansible-cron
- cloud-launcher-cron - cloud-launcher-cron

View File

@ -1,5 +1,19 @@
- hosts: localhost
tasks:
- name: Ensure log directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ zuul.executor.log_root }}/bridge.o.o"
- "{{ zuul.executor.log_root }}/bridge.o.o/ara-report"
- hosts: bridge.openstack.org - hosts: bridge.openstack.org
tasks: tasks:
- name: Set log directory
set_fact:
log_dir: "{{ zuul.executor.log_root }}/bridge.o.o"
- name: Register junit.xml file - name: Register junit.xml file
stat: stat:
path: "{{ zuul.project.src_dir }}/junit.xml" path: "{{ zuul.project.src_dir }}/junit.xml"
@ -13,9 +27,28 @@
verify_host: true verify_host: true
when: _junit.stat.exists|bool when: _junit.stat.exists|bool
# Because during the test we run ansible as root, we need
# to allow ourselves permissions to copy the results
- name: Open ARA results permissions
file:
dest: /var/cache/ansible
mode: u=rwX,g=rX,o=rX
recurse: yes
become: yes
# Note called ansible.sqlite so the middleware on
# logs.o.o picks it up for display
- name: Collect testing ARA results
synchronize:
dest: "{{ log_dir }}/ara-report/ansible.sqlite"
mode: pull
src: "/var/cache/ansible/ara.sqlite"
verify_host: true
ignore_errors: true
- name: Collect ansible configuration - name: Collect ansible configuration
synchronize: synchronize:
dest: "{{ zuul.executor.log_root }}" dest: "{{ log_dir }}/etc"
mode: pull mode: pull
src: "/etc/ansible" src: "/etc/ansible"
verify_host: true verify_host: true

View File

@ -58,3 +58,10 @@ def test_authorized_keys(host):
content = authorized_keys.content.decode('utf8') content = authorized_keys.content.decode('utf8')
lines = content.split('\n') lines = content.split('\n')
assert len(lines) >= 3 assert len(lines) >= 3
def test_ara(host):
ara = host.run('ara playbook list')
assert ara.rc == 0
database = host.file('/var/cache/ansible/ara.sqlite')
assert database.exists