Skip to content

Commit dfb9a8c

Browse files
danpawliksdatko
authored andcommitted
Make a symlink of os_must_gather dir to static name dir
Some teams are using static directory to grab latest CI job results. Let's help them and create a symlink to latest dir. Signed-off-by: Daniel Pawlik <[email protected]>
1 parent 26f0783 commit dfb9a8c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

roles/os_must_gather/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ cifmw_os_must_gather_image: "quay.io/openstack-k8s-operators/openstack-must-gath
2121
cifmw_os_must_gather_image_push: true
2222
cifmw_os_must_gather_image_registry: "quay.rdoproject.org/openstack-k8s-operators"
2323
cifmw_os_must_gather_output_dir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"
24+
cifmw_os_must_gather_output_log_dir: "{{ cifmw_os_must_gather_output_dir }}/logs/openstack-must-gather"
2425
cifmw_os_must_gather_repo_path: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/openstack-must-gather"
2526
cifmw_os_must_gather_timeout: "10m"
2627
cifmw_os_must_gather_additional_namespaces: "kuttl,openshift-storage,openshift-marketplace,openshift-operators,sushy-emulator,tobiko"

roles/os_must_gather/tasks/main.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
- name: Ensure directories are present
1818
ansible.builtin.file:
19-
path: "{{ cifmw_os_must_gather_output_dir }}/logs/openstack-k8s-operators-openstack-must-gather"
19+
path: "{{ cifmw_os_must_gather_output_log_dir }}"
2020
state: directory
2121
mode: "0755"
2222

@@ -63,14 +63,27 @@
6363
oc adm must-gather --image {{ cifmw_os_must_gather_image }}
6464
--timeout {{ cifmw_os_must_gather_timeout }}
6565
--host-network={{ cifmw_os_must_gather_host_network }}
66-
--dest-dir {{ cifmw_os_must_gather_output_dir }}/logs/openstack-k8s-operators-openstack-must-gather
66+
--dest-dir {{ cifmw_os_must_gather_output_log_dir }}
6767
-- ADDITIONAL_NAMESPACES={{ cifmw_os_must_gather_additional_namespaces }}
6868
OPENSTACK_DATABASES=$OPENSTACK_DATABASES
6969
SOS_EDPM=$SOS_EDPM
7070
SOS_DECOMPRESS=$SOS_DECOMPRESS
7171
gather
7272
2>&1
7373
74+
- name: Find existing os-must-gather directories
75+
ansible.builtin.find:
76+
paths: "{{ cifmw_os_must_gather_output_log_dir }}"
77+
file_type: directory
78+
depth: 1
79+
register: _os_gather_latest_dir
80+
81+
- name: Create a symlink to newest os-must-gather directory
82+
ansible.builtin.file:
83+
src: "{{ (_os_gather_latest_dir.files | sort(attribute='mtime', reverse=True) | first).path | basename }}"
84+
dest: "{{ cifmw_os_must_gather_output_log_dir }}/latest"
85+
state: link
86+
7487
rescue:
7588
- name: Openstack-must-gather failure
7689
block:

0 commit comments

Comments
 (0)