Merge "Update ARA"

This commit is contained in:
Zuul 2021-06-01 02:58:27 +00:00 committed by Gerrit Code Review
commit bfa7e72f0d
7 changed files with 35 additions and 50 deletions

View File

@ -21,6 +21,6 @@
# 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.4") }}'
install_ansible_ara_name: '{{ bridge_ara_name | default("ara[server]") }}'
install_ansible_ara_version: '{{ bridge_ara_version | default("latest") }}'
- root-keys

View File

@ -44,7 +44,7 @@ Install and configure Ansible on a host via pip
Whether or not to install the ARA Records Ansible callback plugin
.. zuul:rolevar:: install_ansible_ara_name
:default: ara
:default: ara[server]
The name of the ARA package to install. To install from
alternative sources, this can be a URL for a remote package.
@ -59,13 +59,17 @@ Install and configure Ansible on a host via pip
package and hence the latest version is always installed.
.. zuul:rolevar:: install_ansible_ara_config
:default: {"database": "sqlite:////var/cache/ansible/ara.sqlite"}
A dictionary of key-value pairs to be added to the ARA
configuration file
A dictionary of configuration keys and their values for ARA's Ansible plugins.
*database*: Connection string for the database (ex: mysql+pymysql://ara:password@localhost/ara)
Default configuration keys:
- ``api_client: offline`` (can be ``http`` for sending to remote API servers)
- ``api_server: http://127.0.0.1:8000`` (has no effect when using offline)
- ``api_username: null`` (if required, an API username)
- ``api_password: null`` (if required, an API password)
- ``api_timeout: 30`` (the timeout on http requests)
For a list of available configuration options, see the `ARA documentation`_
.. _ARA documentation: https://ara.readthedocs.io/en/stable/configuration.html
.. _ARA documentation: https://ara.readthedocs.io/en/latest/ara-plugin-configuration.html

View File

@ -1,12 +1,11 @@
# Whether or not to install ARA
install_ansible_ara_enable: false
# See available configuration options in the ARA docs:
# https://ara.readthedocs.io/en/stable/configuration.html
# Note that this may be set in the private host vars when using mysql so we can
# keep the credentials secret.
# See available configuration options for the callback in the ARA docs:
# https://ara.readthedocs.io/en/latest/ara-plugin-configuration.html
install_ansible_ara_config:
# Connection string for ARA
# https://ara.readthedocs.io/en/stable/configuration.html#ara-database
# Ex: mysql+pymysql://ara:password@localhost/ara
database: "sqlite:////var/cache/ansible/ara.sqlite"
api_client: offline
# api_server: http://127.0.0.1:8000
# api_username: null
# api_password: null
# api_timeout: 30

View File

@ -1,9 +1,3 @@
- name: Install pymysql for ara
pip:
name: pymysql
state: present
when: '"pymysql" in install_ansible_ara_config["database"]'
# If ansible_install_ansible_ara_version is not defined it should be "latest"
- name: Set ara default version to latest
set_fact:
@ -27,7 +21,7 @@
- name: Install ARA
pip:
name: '{{ install_ansible_ara_name | default("ara") }}'
name: '{{ install_ansible_ara_name | default("ara[server]") }}'
version: '{{ _install_ansible_ara_version | default(omit) }}'
state: '{{ _install_ansible_ara_state | default(omit) }}'

View File

@ -50,27 +50,18 @@
recurse: yes
become: yes
- name: Ensure ARA log directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ ansible_user_dir }}/zuul-output/logs/ara-report"
- name: Generate ARA static report
command: ara-manage generate /root/.ara/static
become: yes
- name: Copy ARA database into report dir
copy:
remote_src: true
src: /var/cache/ansible/ara.sqlite
dest: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/ara.sqlite"
- name: Create ARA report
include_role:
name: ara-report
vars:
ara_database_path: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/ara.sqlite"
ara_report_path: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/"
ara_report_type: html
ara_report_artifact_prefix: 'bridge.openstack.org/'
- name: Collect testing ARA results
synchronize:
dest: "{{ log_dir }}/ara-report"
mode: pull
src: "/root/.ara/static/"
verify_host: true
become: yes
ignore_errors: true
- name: Collect ansible configuration
synchronize:

View File

@ -58,9 +58,9 @@ def test_root_authorized_keys(host):
def test_ara(host):
ara = host.run('ara playbook list')
ara = host.run('ara-manage migrate')
assert ara.rc == 0
database = host.file('/var/cache/ansible/ara.sqlite')
database = host.file('/root/.ara/server/ansible.sqlite')
assert database.exists

View File

@ -80,10 +80,6 @@
override-checkout: devel
- name: github.com/pytest-dev/pytest-testinfra
- name: openstack/openstacksdk
- name: recordsansible/ara
# NOTE(ianw): 2019-06-11 pinned to stable branch until we handle 1.0
# http://lists.openstack.org/pipermail/openstack-infra/2019-June/006400.html
override-checkout: stable/0.x
- name: github.com/ansible-collections/ansible.posix
override-checkout: main
- name: github.com/ansible-collections/ansible.netcommon
@ -92,12 +88,13 @@
override-checkout: main
- name: github.com/ansible-collections/community.general
override-checkout: main
- name: github.com/ansible-community/ara
vars:
bridge_ansible_name: '{{ ansible_user_dir}}/src/github.com/ansible/ansible'
bridge_ansible_version: null
bridge_openstacksdk_name: '{{ ansible_user_dir }}/src/opendev.org/openstack/openstacksdk'
bridge_openstacksdk_version: null
bridge_ara_name: '{{ ansible_user_dir}}/src/opendev.org/recordsansible/ara'
bridge_ara_name: '{{ ansible_user_dir}}/src/github.com/ansible-community/ara[server]'
bridge_ara_version: null
# Although we don't have an arm64 based bridge; Zuul can't currently