--- - name: Load parameters ansible.builtin.include_vars: dir: "{{ cifmw_basedir }}/artifacts/parameters" - name: Use the locally built operators if any ansible.builtin.set_fact: _local_operators_indexes: "{{ _local_operators_indexes|default({}) | combine({ item.key.split('-')[0]|upper+'_IMG': cifmw_operator_build_output['operators'][item.key].image_catalog}) }}" loop: "{{ cifmw_operator_build_output['operators'] | dict2items }}" when: - cifmw_operator_build_output is defined - "'operators' in cifmw_operator_build_output" - name: Set environment vars for kuttl test ansible.builtin.set_fact: cifmw_kuttl_tests_env: >- {{ _local_operators_indexes | default({}) | combine(cifmw_install_yamls_environment) | combine(cifmw_kuttl_tests_env_vars | default({})) | combine(cifmw_kuttl_openstack_prep_vars | default({})) | combine({'PATH': cifmw_path}) }} - name: Clean storage beforehand ansible.builtin.include_role: name: 'ci_local_storage' tasks_from: 'cleanup.yml' - name: Create storage ansible.builtin.include_role: name: 'ci_local_storage' - name: 'Get resource status before {{ operator }}_kuttl run' environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.shell: | {{ item }} >> {{ cifmw_artifacts_basedir }}/logs/cmd_before_{{ operator }}_kuttl.log loop: "{{ commands_before_kuttl_run }}" ignore_errors: true - name: 'Set make_{{ operator }}_kuttl_env vars' ansible.builtin.set_fact: make_{{ operator }}_kuttl_env: "{{ cifmw_kuttl_tests_env }}" - name: 'Run make_{{ operator }}_kuttl' ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_{{ operator }}_kuttl.yml' apply: ignore_errors: true # noqa: ignore-errors - name: 'Get resource status after {{ operator }}_kuttl run' environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.shell: | {{ item }} >> {{ cifmw_artifacts_basedir }}/logs/cmd_after_{{ operator }}_kuttl.log loop: "{{ commands_after_kuttl_run }}" ignore_errors: true # Some of the xml files may not be the JUnitXML results, but getting the exact file # name (parsing the KUTTL configuration) may be too cumbersome. - name: Find the generated JUnitXML files ansible.builtin.find: paths: "{{ cifmw_installyamls_repos }}" file_type: file patterns: '*.xml' register: "_cifmw_kuttl_xml_files" - name: Copy the log results of {{ operator }} vars: _kuttl_test_result_dir: "{{ cifmw_artifacts_basedir }}/tests/kuttl_{{ operator }}" block: - name: Create the test results directory ansible.builtin.file: path: "{{ _kuttl_test_result_dir }}" state: directory mode: '0755' - name: Copy the generated test results to the test results directory ansible.builtin.copy: src: "{{ item.path }}" dest: "{{ _kuttl_test_result_dir }}" mode: '0644' loop: "{{ _cifmw_kuttl_xml_files.files }}" ignore_errors: true # noqa: ignore-errors # Note: the variable checked here is set by the specific autogenerated task # for the autogenerated install_yamls_makes role. - name: Fail when any tests failed vars: _kuttl_curr_operator_result: "{{ lookup('vars', 'make_' + operator + '_kuttl_status')|default(1) }}" ansible.builtin.assert: that: - _kuttl_curr_operator_result.rc == 0 success_msg: "KUTTL tests for {{ operator }} passed" fail_msg: "KUTTL tests for {{ operator }} failed"