From 24a861c4f81aaac55bd3458e29ee24ce0e07e125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Lobillo?= Date: Tue, 26 Nov 2024 21:49:10 +0100 Subject: [PATCH] [shiftstack]Enable the option to run the role isolated In order to allow users to run the shiftsatck role without being part of the whole reproducer, below changes are needed: - Add missing kubeconfig param - Load .bashrc whle running the ansible-navigator. That's needed for reading the envvars that will be used for writting the junit report. - Enable the option to exclude artifacts to be gathered. --- roles/shiftstack/README.md | 1 + roles/shiftstack/defaults/main.yml | 1 + roles/shiftstack/tasks/pre_test_shiftstack.yml | 1 + roles/shiftstack/tasks/test_config.yml | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/shiftstack/README.md b/roles/shiftstack/README.md index 7e1eb47639..fa9f41ef38 100644 --- a/roles/shiftstack/README.md +++ b/roles/shiftstack/README.md @@ -11,6 +11,7 @@ Role for triggering Openshift on Openstack QA automation (installation and tests * `cifmw_shiftstack_client_pod_image`: (*string*) The image for the container running in the `cifmw_shiftstack_client_pod_name` pod. Defaults to `quay.io/shiftstack-qe/shiftstack-client:latest`. * `cifmw_shiftstack_client_pvc_manifest`: (*string*) The file name for the shiftstackclient pvc manifest. Defaults to `"{{ cifmw_shiftstack_client_pod_name }}_pvc.yml"`. * `cifmw_shiftstack_cluster_name`: (*string*) The Openshift cluster name. Defaults to `ostest`. +* `cifmw_shiftstack_exclude_artifacts_regex`: (*string*) Regex that will be passed on `oc rsync` command as `--exclude` param, so the role does not gather the artifacts matching it. * `cifmw_shiftstack_installation_dir`: (*string*) Directory to place installation files. Defaults to `"{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/installation"`. * `cifmw_shiftstack_manifests_dir`: (*string*) Directory name for the role generated Openshift manifests. Defaults to `"{{ cifmw_shiftstack_basedir }}/manifests"`. * `cifmw_shiftstack_project_name`: (*string*) The Openstack project name. Defaults to `shiftstack`. diff --git a/roles/shiftstack/defaults/main.yml b/roles/shiftstack/defaults/main.yml index 3956c8a84d..112ace7a16 100644 --- a/roles/shiftstack/defaults/main.yml +++ b/roles/shiftstack/defaults/main.yml @@ -26,6 +26,7 @@ cifmw_shiftstack_client_pod_name: "shiftstackclient-{{ cifmw_shiftstack_project_ cifmw_shiftstack_client_pod_namespace: "openstack" cifmw_shiftstack_client_pvc_manifest: "{{ cifmw_shiftstack_client_pod_name }}_pvc.yml" cifmw_shiftstack_cluster_name: "ostest" +cifmw_shiftstack_exclude_artifacts_regex: "openshift-install" cifmw_shiftstack_installation_dir: "{{ cifmw_shiftstack_basedir }}/installation" cifmw_shiftstack_manifests_dir: "{{ cifmw_shiftstack_basedir }}/manifests" cifmw_shiftstack_project_name: "shiftstack" diff --git a/roles/shiftstack/tasks/pre_test_shiftstack.yml b/roles/shiftstack/tasks/pre_test_shiftstack.yml index 001ced3049..a285016b9a 100644 --- a/roles/shiftstack/tasks/pre_test_shiftstack.yml +++ b/roles/shiftstack/tasks/pre_test_shiftstack.yml @@ -21,6 +21,7 @@ - name: Remove the shiftstackclient pod if exists kubernetes.core.k8s: + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" state: absent api_version: v1 kind: Pod diff --git a/roles/shiftstack/tasks/test_config.yml b/roles/shiftstack/tasks/test_config.yml index c6d697d32d..0a5cb1d66b 100644 --- a/roles/shiftstack/tasks/test_config.yml +++ b/roles/shiftstack/tasks/test_config.yml @@ -31,6 +31,7 @@ namespace: "{{ cifmw_shiftstack_client_pod_namespace }}" pod_name: "{{ cifmw_shiftstack_client_pod_name }}" command: >- + source .bashrc && 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 @@ -53,7 +54,7 @@ KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" ansible.builtin.command: cmd: > - oc rsync -n {{ cifmw_shiftstack_client_pod_namespace }} + oc rsync -n {{ cifmw_shiftstack_client_pod_namespace }} --exclude={{ cifmw_shiftstack_exclude_artifacts_regex }} {{ cifmw_shiftstack_client_pod_name }}:{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/ {{ testconfig_artifacts_dir }}/ failed_when: false