--- # 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 gerrithub change '{{ cifmw_shiftstack_qa_gerrithub_change }}' 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_gerrithub_change }} && git checkout FETCH_HEAD log_file_name: "fetch_shiftstack_qa_gerrithub_change.log" when: - cifmw_shiftstack_qa_gerrithub_change is defined - cifmw_shiftstack_qa_gerrithub_change != '' 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