Add a toggle to enable saving the ARA sqlite database

It might be useful for jobs to save the ARA sqlite database, for
example for debugging purposes, or if they want to import and use
the database elsewhere.

Change-Id: Ie82b42c34dfe6173116d88cc174deda70c5aa9ad
This commit is contained in:
David Moreau-Simard 2017-10-12 12:57:12 -04:00
parent 75705bc3bf
commit fcc707c221
No known key found for this signature in database
GPG Key ID: 33A07694CBB71ECC
3 changed files with 17 additions and 1 deletions

View File

@ -12,6 +12,11 @@ Have ARA generate html logs if ARA and ARA data are both present.
Whether to compress the ARA HTML output or not. Whether to compress the ARA HTML output or not.
Defaults to ``true``. Defaults to ``true``.
.. zuul:rolevar:: ara_save_database
Whether the ARA sqlite database should be saved as part of the logs.
Defaults to ``false``.
.. tip:: .. tip::
Make sure the web server is configured to set the required mimetypes_ in Make sure the web server is configured to set the required mimetypes_ in
order to serve gzipped content properly. order to serve gzipped content properly.

View File

@ -3,3 +3,6 @@ ara_generate_html: true
# Whether to compress the ARA HTML output or not # Whether to compress the ARA HTML output or not
ara_compress_html: true ara_compress_html: true
# Whether to save the ARA sqlite database as part of the logs or not
ara_save_database: false

View File

@ -3,6 +3,14 @@
path: "{{ zuul.executor.work_root }}/.ara/ansible.sqlite" path: "{{ zuul.executor.work_root }}/.ara/ansible.sqlite"
register: ara_db_stat register: ara_db_stat
- name: Save the ARA database
command: |
cp "{{ zuul.executor.work_root }}/.ara/ansible.sqlite" \
{{ zuul.executor.log_root }}
when:
- ara_db_stat.stat.exists
- ara_save_database | bool
- name: Check for ARA install - name: Check for ARA install
command: which ara command: which ara
ignore_errors: yes ignore_errors: yes
@ -20,4 +28,4 @@
- name: Compress ARA html output - name: Compress ARA html output
command: gzip --recursive --best {{ zuul.executor.log_root }}/ara command: gzip --recursive --best {{ zuul.executor.log_root }}/ara
ignore_errors: yes ignore_errors: yes
when: ara_compress_html | bool when: ara_compress_html | bool