From a5966ce209511dbd41bf31c038f713f7367c1cc7 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 30 Sep 2024 11:37:56 +0200 Subject: [PATCH] Use archives for test logs This is due to the ansible fetch module either flattening files directly onto the destination directory, overwritten files with the same name, or keeping a long path that includes the hostname and the full path to the files. Best workaround I could come up with is to generate uniquely named archives that hold all logs with the proper paths and files, then move those with the flat option. --- .github/workflows/integration-tests-vm-type.yml | 4 ++-- .../tasks/test-collection-method.yml | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-tests-vm-type.yml b/.github/workflows/integration-tests-vm-type.yml index c519811369..276070e720 100644 --- a/.github/workflows/integration-tests-vm-type.yml +++ b/.github/workflows/integration-tests-vm-type.yml @@ -127,6 +127,6 @@ jobs: with: name: ${{ inputs.vm_type }}-logs path: | - ${{ github.workspace }}/integration-tests/container-logs/**/** - ${{ github.workspace }}/integration-tests/performance-logs/**/** + ${{ github.workspace }}/integration-tests/container-logs/ + ${{ github.workspace }}/integration-tests/performance-logs/ if-no-files-found: ignore diff --git a/ansible/roles/run-test-target/tasks/test-collection-method.yml b/ansible/roles/run-test-target/tasks/test-collection-method.yml index bada414be6..1635edbac6 100644 --- a/ansible/roles/run-test-target/tasks/test-collection-method.yml +++ b/ansible/roles/run-test-target/tasks/test-collection-method.yml @@ -8,7 +8,7 @@ # - set_fact: - logs_root: "{{ collector_root }}/integration-tests/container-logs/{{ vm_config }}/{{ collection_method }}" + logs_root: "{{ collector_root }}/integration-tests/container-logs" - name: Cleanup old containers become: "{{ runtime_as_root }}" @@ -122,20 +122,16 @@ path: "{{ logs_root }}" delegate_to: localhost - - name: Get log files - find: - paths: "{{ remote_log_mount }}/{{ vm_config }}/{{ collection_method }}/" - recurse: true - register: remote_log_files + - name: Compress log files + ansible.builtin.archive: + path: "{{ remote_log_mount }}" + dest: /tmp/{{ vm_config }}-{{ collection_method }}.tar.gz - name: Fetch log files fetch: - src: "{{ remote_log_path }}" + src: /tmp/{{ vm_config }}-{{ collection_method }}.tar.gz dest: "{{ logs_root }}/" flat: true - loop: "{{ remote_log_files.files | map(attribute='path') | list }}" - loop_control: - loop_var: remote_log_path - name: Write integration test log copy: