diff --git a/.zuul.yaml b/.zuul.yaml index a36063f466..fde5a35498 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -127,6 +127,8 @@ pre-run: playbooks/zuul/run-base-pre.yaml run: playbooks/zuul/run-base.yaml post-run: playbooks/zuul/run-base-post.yaml + vars: + install_ansible_ara_enable: true - job: name: system-config-run-base @@ -166,11 +168,14 @@ - name: github.com/ansible/ansible override-checkout: devel - name: openstack/openstacksdk + - name: openstack/ara vars: bridge_ansible_name: '{{ ansible_user_dir}}/src/github.com/ansible/ansible' bridge_ansible_version: null bridge_openstacksdk_name: '{{ ansible_user_dir }}/src/git.openstack.org/openstack/openstacksdk' bridge_openstacksdk_version: null + bridge_ara_name: '{{ ansible_user_dir}}/src/git.openstack.org/openstack/ara' + bridge_ara_version: null - job: name: system-config-run-eavesdrop diff --git a/playbooks/bridge.yaml b/playbooks/bridge.yaml index 7d0e488e57..44b173bf29 100644 --- a/playbooks/bridge.yaml +++ b/playbooks/bridge.yaml @@ -15,6 +15,11 @@ install_ansible_version: '{{ bridge_ansible_version | default("2.7.3") }}' install_ansible_openstacksdk_name: '{{ bridge_openstacksdk_name | default("openstacksdk") }}' 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 - ansible-cron - cloud-launcher-cron diff --git a/playbooks/zuul/run-base-post.yaml b/playbooks/zuul/run-base-post.yaml index 8adf1a9e88..a8813d4f5c 100644 --- a/playbooks/zuul/run-base-post.yaml +++ b/playbooks/zuul/run-base-post.yaml @@ -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 tasks: + - name: Set log directory + set_fact: + log_dir: "{{ zuul.executor.log_root }}/bridge.o.o" + - name: Register junit.xml file stat: path: "{{ zuul.project.src_dir }}/junit.xml" @@ -13,9 +27,28 @@ verify_host: true 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 synchronize: - dest: "{{ zuul.executor.log_root }}" + dest: "{{ log_dir }}/etc" mode: pull src: "/etc/ansible" verify_host: true diff --git a/testinfra/test_bridge.py b/testinfra/test_bridge.py index b46eff7833..31d0f5da98 100644 --- a/testinfra/test_bridge.py +++ b/testinfra/test_bridge.py @@ -58,3 +58,10 @@ def test_authorized_keys(host): content = authorized_keys.content.decode('utf8') lines = content.split('\n') 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