Martin Kopec 3a7b72ba93 Add devstack jobs to run the role
The patch mainly adds devstack jobs to run the role against master and
the three last OpenStack releases. In addition
to that the following changes were made as well:
* upload_results and download_artifacts will be False by default
* added more comments
* a few tasks from main.yaml got moved to standalone files in order
  to increase readability

Change-Id: Ice0c5958ad179b2d9bc1b2f4d103e4be67a2a773
2020-12-07 13:54:41 +00:00

86 lines
2.7 KiB
YAML

---
# The task finds the latest result file in case there are more of them
# e.g. refstack-client was already executed in the current env
- name: Find the test result json file
shell: |
set -o pipefail -ex
ls | grep "\.json" | tail -1
register: ls_out
args:
chdir: "{{ refstack_client_source }}/.tempest/.stestr"
executable: /bin/bash
changed_when: false
- when: upload_results | bool
block:
# refstack doesn't allow annonymous results uploading anymore, therefore
# this task copies user's key to the target machine (if needed) so that it
# can be used in the following task which uploads the result to the user's
# refstack account
- name: Copy private key
copy:
src: "{{ private_key_path_src }}"
dest: "{{ private_key_path }}"
mode: '0600'
when:
- private_key_path is defined
- private_key_path_src is defined
- name: Upload results with signature
shell: |
set -ex
source .venv/bin/activate
refstack-client upload -y ".tempest/.stestr/{{ ls_out.stdout }}" \
--url {{ server }} \
-i {{ private_key_path }}
register: upload_out
args:
chdir: "{{ refstack_client_source }}"
executable: /bin/bash
when:
- private_key_path is defined
- debug:
msg: "{{ upload_out.stdout }}"
# this becomes handy when the role is executed on a remote node from
# an executor node (e.g. a Jenkins job) when the below artifacts might be
# needed for a further processing (e.g. part of log collection of the job)
- when: download_artifacts | bool
block:
- name: Download results file in .json
fetch:
src: "{{ refstack_client_source }}/.tempest/.stestr/{{ ls_out.stdout }}"
dest: "{{ dest_dir }}/test_results.json"
flat: true
- name: Download results file in subunit
fetch:
src: "{{ refstack_client_source }}/.tempest/.stestr/{{ ls_out.stdout | splitext | first }}"
dest: "{{ dest_dir }}/test_results_subunit"
flat: true
- name: Dump output of upload command
copy:
content: "{{ upload_out.stdout }}"
dest: "{{ dest_dir }}/upload_output.txt"
mode: '0644'
delegate_to: localhost
when: upload_out is defined
- name: Download tempest.conf file
fetch:
src: "{{ path_to_tempest_config }}"
dest: "{{ dest_dir }}/tempest.conf"
flat: true
args:
chdir: "{{ refstack_client_source }}"
- name: Download accounts.yaml file
fetch:
src: "{{ path_to_accounts_file }}"
dest: "{{ dest_dir }}/accounts.yaml"
flat: true
args:
chdir: "{{ refstack_client_source }}"