-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OSASINFRA] Add multi test configs support
Support multiple test configs or job definitions from the calling zuul job, i.e: cifmw_run_test_shiftstack_testconfig: - 4.16_ovnkubernetes_ipi_va1.yaml - 4.16_ovnkubernetes_upi_va1.yaml The shiftstack role will run the shiftstack-qa automation for each test config defined in `cifmw_run_test_shiftstack_testconfig`. The artifacts directory includes now an additional directory for each test config, as multiple test configs can run now from a Zuul job. This commit adds the `cifmw_shiftstack_manifests_dir` param as well for the role generated manifest files and the `cifmw_shiftstack_ansible_command_logs_dir` param for the ansible command module output logs.
- Loading branch information
Showing
8 changed files
with
179 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
# These tasks are intended to be run inside a loop, where `testconfig` | ||
# is the loop parameter and can take different values in each run. | ||
- name: OCP install and test block | ||
vars: | ||
testconfig_dir_name: "{{ testconfig | splitext | first }}" | ||
testconfig_artifacts_dir: "{{ (cifmw_shiftstack_artifacts_dir, testconfig_dir_name) | path_join }}" | ||
|
||
block: | ||
- name: "Initialize the testconfig_result_dict fact for the testconfig '{{ testconfig }}'" | ||
ansible.builtin.set_fact: | ||
testconfig_result_dict: "{{ testconfig_result_dict | combine({ testconfig : 'PASS' }) }}" | ||
|
||
- name: "Check the test configuration file exists in the repository" | ||
vars: | ||
namespace: "{{ cifmw_shiftstack_client_pod_namespace }}" | ||
pod_name: "{{ cifmw_shiftstack_client_pod_name }}" | ||
command: >- | ||
test -f shiftstack-qa/jobs_definitions/{{ testconfig }} | ||
log_file_name: "{{ testconfig }}-find_test_config.log" | ||
ansible.builtin.include_tasks: exec_command_in_pod.yml | ||
|
||
- name: "Create the directory for the test config artifacts '{{ testconfig_artifacts_dir }}'" | ||
ansible.builtin.file: | ||
path: "{{ testconfig_artifacts_dir }}" | ||
state: directory | ||
mode: "0755" | ||
|
||
# - name: "Test Openshift on Openstack with the test configuration '{{ testconfig }}'" | ||
# vars: | ||
# namespace: "{{ cifmw_shiftstack_client_pod_namespace }}" | ||
# pod_name: "{{ cifmw_shiftstack_client_pod_name }}" | ||
# command: >- | ||
# cd shiftstack-qa && | ||
# ansible-navigator run playbooks/{{ cifmw_shiftstack_run_playbook }} -e @jobs_definitions/{{ testconfig }} -e ocp_cluster_name={{ cifmw_shiftstack_cluster_name }} -e user_cloud={{ cifmw_shiftstack_project_name }} | ||
# ansible.builtin.include_tasks: exec_command_in_pod.yml | ||
|
||
rescue: | ||
- name: "Set failure info for '{{ testconfig }}'" | ||
ansible.builtin.set_fact: | ||
failure_info: | ||
failed_task: "{{ ansible_failed_task.name }}" | ||
result_msg: "{{ ansible_failed_result.msg }}" | ||
|
||
- name: "Update the testconfig_result_dict fact with a failed status for '{{ testconfig }}'" | ||
ansible.builtin.set_fact: | ||
testconfig_result_dict: "{{ testconfig_result_dict | combine({testconfig: {'FAIL': failure_info}}) }}" | ||
|
||
always: | ||
- name: "Copy the artifacts from the pod '{{ cifmw_shiftstack_client_pod_name }}'" | ||
environment: | ||
PATH: "{{ cifmw_path }}" | ||
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" | ||
ansible.builtin.command: | ||
cmd: > | ||
oc rsync -n {{ cifmw_shiftstack_client_pod_namespace }} | ||
{{ cifmw_shiftstack_client_pod_name }}:{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/ | ||
{{ testconfig_artifacts_dir }}/ | ||
ignore_errors: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters