-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathtest_shiftstack.yml
More file actions
79 lines (70 loc) · 2.95 KB
/
Copy pathtest_shiftstack.yml
File metadata and controls
79 lines (70 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Clone the repository '{{ cifmw_shiftstack_qa_repo }}'
vars:
namespace: "{{ cifmw_shiftstack_client_pod_namespace }}"
pod_name: "{{ cifmw_shiftstack_client_pod_name }}"
command: >-
git clone {{ cifmw_shiftstack_qa_repo }}
log_file_name: "clone_shiftstack_qa_repo.log"
ansible.builtin.include_tasks: exec_command_in_pod.yml
- name: Fetch the change ref '{{ cifmw_shiftstack_qa_change_ref }}'
vars:
namespace: "{{ cifmw_shiftstack_client_pod_namespace }}"
pod_name: "{{ cifmw_shiftstack_client_pod_name }}"
command: >-
cd shiftstack-qa &&
git fetch {{ cifmw_shiftstack_qa_repo }} {{ cifmw_shiftstack_qa_change_ref }} &&
git checkout FETCH_HEAD
log_file_name: "fetch_shiftstack_qa_change_ref.log"
when:
- cifmw_shiftstack_qa_change_ref is defined
- cifmw_shiftstack_qa_change_ref != ''
ansible.builtin.include_tasks: exec_command_in_pod.yml
- name: Install the ansible collections
vars:
namespace: "{{ cifmw_shiftstack_client_pod_namespace }}"
pod_name: "{{ cifmw_shiftstack_client_pod_name }}"
command: >-
cd shiftstack-qa && ansible-galaxy collection install -f -r requirements.yaml
log_file_name: "install_collections.log"
ansible.builtin.include_tasks: exec_command_in_pod.yml
- name: Initialize a dictionary to store the result of the test configs
ansible.builtin.set_fact:
testconfig_result_dict: {}
- name: Include test config tasks and loop over '{{ cifmw_run_test_shiftstack_testconfig }}'
ansible.builtin.include_tasks: test_config.yml
loop: "{{ cifmw_run_test_shiftstack_testconfig }}"
loop_control:
loop_var: testconfig
index_var: current_index
- name: Initialize a list to store failed test configs
ansible.builtin.set_fact:
failed_test_configs: []
- name: Find failed test configurations
ansible.builtin.set_fact:
failed_test_configs: "{{ failed_test_configs + [{item.key: test_config_name}] }}"
loop: "{{ testconfig_result_dict | dict2items }}"
vars:
test_config_name: "{{ item.value.keys() | list | first }}"
when: "'FAIL' in item.value[test_config_name]"
- name: Print test configs result
ansible.builtin.debug:
msg: "{{ testconfig_result_dict | to_nice_json }}"
- name: Fail if there is any failed test config
ansible.builtin.fail:
msg: "There are FAILED test configs: {{ failed_test_configs }}"
when: failed_test_configs | length > 0