Skip to content

Commit

Permalink
Use archives for test logs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Molter73 committed Sep 30, 2024
1 parent 13dc4e4 commit a5966ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests-vm-type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 6 additions & 10 deletions ansible/roles/run-test-target/tasks/test-collection-method.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a5966ce

Please sign in to comment.