Skip to content

Commit

Permalink
[shiftstack]Enable the option to run the role isolated
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rlobillo authored and openshift-merge-bot[bot] committed Dec 20, 2024
1 parent 843c6f0 commit e53622f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions roles/shiftstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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`.
Expand Down
1 change: 1 addition & 0 deletions roles/shiftstack/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,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"
Expand Down
1 change: 1 addition & 0 deletions roles/shiftstack/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}"
cifmw_openshift_kubeconfig: "{{ ansible_user_dir }}/.crc/machines/crc/kubeconfig"
cifmw_shiftstack_run_playbook: cifmw-gate.yaml
cifmw_shiftstack_exclude_artifacts_regex: ''
cifmw_run_test_shiftstack_testconfig:
- cifmw-gate.yaml
- cifmw-gate.yaml # The purpose of this repeated test config is to check the test config loop logic
Expand Down
1 change: 1 addition & 0 deletions roles/shiftstack/tasks/pre_test_shiftstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion roles/shiftstack/tasks/test_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,12 +49,19 @@

always:
- name: "Copy the artifacts from the pod '{{ cifmw_shiftstack_client_pod_name }}'"
vars:
_exclude_options: >-
{{
'--exclude=' ~ cifmw_shiftstack_exclude_artifacts_regex
if cifmw_shiftstack_exclude_artifacts_regex | default('') != ''
else ''
}}
environment:
PATH: "{{ cifmw_path }}"
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_options }}
{{ cifmw_shiftstack_client_pod_name }}:{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/
{{ testconfig_artifacts_dir }}/
failed_when: false

0 comments on commit e53622f

Please sign in to comment.