diff --git a/test-playbooks/registry/test-registry-post.yaml b/test-playbooks/registry/test-registry-post.yaml new file mode 100644 index 000000000..ee18eee5a --- /dev/null +++ b/test-playbooks/registry/test-registry-post.yaml @@ -0,0 +1,26 @@ +- hosts: all + tasks: + - name: List containers + command: "docker ps -a --format '{{ '{{ .Names }}' }}'" + register: docker_containers + ignore_errors: true + become: true + + - name: Create container log dir + file: + path: "{{ ansible_user_dir }}/zuul-output/logs/docker" + state: directory + + - name: Save container logs + loop: "{{ docker_containers.stdout_lines | default([]) }}" + shell: "docker logs {{ item }} &> {{ ansible_user_dir }}/zuul-output/logs/docker/{{ item }}.txt" + args: + executable: /bin/bash + become: true + + - name: Open container logs permissions + file: + dest: "{{ ansible_user_dir }}/zuul-output/logs/docker" + mode: u=rwX,g=rX,o=rX + recurse: yes + become: yes diff --git a/zuul-tests.d/container-roles-jobs.yaml b/zuul-tests.d/container-roles-jobs.yaml index 729be52c3..df4fe070d 100644 --- a/zuul-tests.d/container-roles-jobs.yaml +++ b/zuul-tests.d/container-roles-jobs.yaml @@ -15,6 +15,7 @@ - roles/use-buildset-registry/.* - test-playbooks/registry/.* run: test-playbooks/registry/test-registry.yaml + post-run: test-playbooks/registry/test-registry-post.yaml nodeset: nodes: - name: intermediate-registry