1c2c574b92
Added option for private_key_path_src variable to contain also URL to remote location. Change-Id: I0777455078d9b5d9d878778c1f4d44a8a475838a
99 lines
3.3 KiB
YAML
99 lines
3.3 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
|
|
find:
|
|
path: "{{ refstack_client_source }}/.tempest/.stestr"
|
|
patterns: '*.json'
|
|
register: ls_out
|
|
|
|
- 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
|
|
block:
|
|
- name: Copy private key from local machine
|
|
copy:
|
|
src: "{{ private_key_path_src }}"
|
|
dest: "{{ private_key_path }}"
|
|
mode: '0600'
|
|
when:
|
|
- private_key_path is defined
|
|
- private_key_path_src is defined
|
|
rescue:
|
|
- name: Copy private key from remote machine
|
|
get_url:
|
|
url: "{{ 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 "{{ ls_out.files[-(item[0] | int + 1) | int].path }}" \
|
|
--url {{ server }} \
|
|
-i {{ private_key_path }}
|
|
register: upload_out
|
|
args:
|
|
chdir: "{{ refstack_client_source }}"
|
|
executable: /bin/bash
|
|
with_indexed_items: "{{ refstack_target_programs }}"
|
|
when:
|
|
- private_key_path is defined
|
|
|
|
- name: Print output of the upload command
|
|
debug:
|
|
msg: "{{ upload_out }}"
|
|
|
|
# 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: "{{ ls_out.files[-(item[0] | int + 1) | int].path }}"
|
|
dest: "{{ dest_dir }}/test_results{{ (item[0] | int + 1) | int }}.json"
|
|
flat: true
|
|
with_indexed_items: "{{ refstack_target_programs }}"
|
|
|
|
- name: Download results file in subunit
|
|
fetch:
|
|
src: "{{ ls_out.files[-(item[0] | int + 1) | int].path | splitext | first }}"
|
|
dest: "{{ dest_dir }}/test_results_subunit {{ (item[0] | int + 1) | int }}"
|
|
flat: true
|
|
with_indexed_items: "{{ refstack_target_programs }}"
|
|
|
|
- name: Dump output of upload command
|
|
copy:
|
|
content: "{{ upload_out }}"
|
|
dest: "{{ dest_dir }}/upload_output.txt"
|
|
mode: '0644'
|
|
delegate_to: localhost
|
|
when: upload_results | bool
|
|
|
|
- name: Download tempest_admin.conf file
|
|
fetch:
|
|
src: "{{ path_to_admin_tempest_config }}"
|
|
dest: "{{ dest_dir }}/tempest_admin.conf"
|
|
flat: true
|
|
|
|
- name: Download tempest.conf file
|
|
fetch:
|
|
src: "{{ path_to_tempest_config }}"
|
|
dest: "{{ dest_dir }}/tempest.conf"
|
|
flat: true
|
|
|
|
- name: Download accounts.yaml file
|
|
fetch:
|
|
src: "{{ path_to_accounts_file }}"
|
|
dest: "{{ dest_dir }}/accounts.yaml"
|
|
flat: true
|