
The copy module look for a directory or file locally, and copy to remote machine. In upstream, this code works, because we run quickstart in the undercloud machine. However, if you're running quickstart on a different machine, it will try to search locally for /var/lib/tempestdata, which doesn't exist. Use remote_src doesn't work for recursive directory. The other option was to use synchronize but it's very slow for recursive directories. The best option is to use command to copy locally. https://tree.taiga.io/project/tripleo-ci-board/issue/836?kanban-status=2027734 Change-Id: I589241e657178909b115fcfdca907ac16dc79b71 Closes-Bug: 1819440
94 lines
3.4 KiB
YAML
94 lines
3.4 KiB
YAML
---
|
|
- ignore_errors: true
|
|
when: tempest_format == 'container'
|
|
block:
|
|
- name: Set the proper permission for tempest directory and files
|
|
file:
|
|
dest: "/var/lib/tempestdata"
|
|
owner: "{{ undercloud_user }}"
|
|
group: "{{ undercloud_user }}"
|
|
recurse: true
|
|
become: true
|
|
|
|
# Using cp here because copy module doesn't allow recursive copy with
|
|
# remote_src set to true and synchronize is too slow
|
|
- name: copy files from tempest container to home directory
|
|
command: "cp -Rf --reflink=auto /var/lib/tempestdata/tempest {{ working_dir }}"
|
|
args:
|
|
warn: false
|
|
changed_when: true
|
|
|
|
- block:
|
|
- name: Check for .stestr directory
|
|
stat:
|
|
path: "{{ working_dir }}/tempest/.stestr"
|
|
register: testr_dir
|
|
|
|
- name: Define testr facts
|
|
set_fact:
|
|
testr_command: "{{ testr_dir.stat.exists | ternary(python_cmd + ' -m stestr.cli', 'testr') }}"
|
|
|
|
- name: Change permission of tempest container log directory
|
|
shell: |
|
|
sudo chmod -R 777 /var/log/containers/tempest
|
|
when: tempest_format == 'container'
|
|
|
|
- name: Generate testrepository.subunit results file
|
|
shell: >
|
|
set -o pipefail &&
|
|
{% if tempest_format == 'venv' %}source {{ working_dir }}/tempest_git/.venv/bin/activate; {% endif %}
|
|
{{ testr_command }} last --subunit | subunit-1to2 > {{ working_dir }}/tempest/testrepository.subunit
|
|
args:
|
|
chdir: "{{ working_dir }}/tempest"
|
|
|
|
- name: Generate HTML results file
|
|
shell: |
|
|
set -o pipefail &&
|
|
{% if tempest_format == 'venv' %}source {{ working_dir }}/tempest_git/.venv/bin/activate; {% endif %}
|
|
subunit2html {{ working_dir }}/tempest/testrepository.subunit {{ working_dir }}/tempest/tempest.html
|
|
|
|
- name: Generate XML results file
|
|
shell: |
|
|
set -o pipefail &&
|
|
{%- if tempest_format == 'venv' -%}
|
|
source {{ working_dir }}/tempest_git/.venv/bin/activate;
|
|
{%- endif -%}
|
|
subunit2junitxml {{ working_dir }}/tempest/testrepository.subunit --output-to {{ working_dir }}/tempest/tempest.xml 2>&1 >> {{ tempest_log_file }}
|
|
|
|
- name: Fetch HTML results
|
|
fetch:
|
|
src: "{{ working_dir }}/tempest/tempest.html"
|
|
dest: "{{ local_working_dir }}/tempest.html"
|
|
flat: true
|
|
|
|
- name: Fetch nosetests results
|
|
fetch:
|
|
src: "{{ working_dir }}/tempest/tempest.xml"
|
|
dest: "{{ local_working_dir }}/nosetests.xml"
|
|
flat: true
|
|
|
|
- name: Copying tempestmail files
|
|
synchronize:
|
|
src: tempestmail/
|
|
dest: "{{ working_dir }}/tempestmail/"
|
|
use_ssh_args: true
|
|
|
|
- name: Copying skip file
|
|
synchronize:
|
|
src: "vars/tempest_skip_{{ release }}.yml"
|
|
dest: "{{ working_dir }}/tempestmail/"
|
|
use_ssh_args: true
|
|
|
|
- name: Send tempest results by mail
|
|
shell: >
|
|
{% if lookup('env', 'LOG_PATH') %}LOG_PATH='{{ lookup('env', 'LOG_PATH') }}' {% endif %}
|
|
./tempestmail.py -c {{ tempestmail_config }} --job
|
|
"{{ lookup('env', 'JOB_NAME')|default('Periodic job', true) }}"
|
|
--file "{{ working_dir }}/{{ tempest_log_file }}"
|
|
--log-url "{{ tempestmail_log_server }}"
|
|
--skip-file "{{ working_dir }}/tempestmail/tempest_skip_{{ release }}.yml" ||
|
|
{ ERR=$?; echo -e "\0127ARNING: Send tempest results by mail failed with code $ERR"; exit $ERR; }
|
|
args:
|
|
chdir: "{{ working_dir }}/tempestmail"
|
|
ignore_errors: true
|