From ed1fa5cc027543e12ffdce1f085c3b4021186d94 Mon Sep 17 00:00:00 2001 From: addshore Date: Thu, 22 Sep 2022 17:30:51 +0200 Subject: [PATCH 1/4] Always output docker logs in CI This would help debug issues such as https://github.com/wmde/wikibase-release-pipeline/pull/364 --- .github/workflows/built_and_test.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/built_and_test.yml b/.github/workflows/built_and_test.yml index 72f545f97..ac035d4c5 100644 --- a/.github/workflows/built_and_test.yml +++ b/.github/workflows/built_and_test.yml @@ -483,13 +483,17 @@ jobs: DATABASE_IMAGE_NAME: ${{ matrix.databaseImageName }} run: make test SUITE=${{ matrix.suite }} - - name: Report + - name: Report Selenium if: always() run: | cd test/reporter npm install SUITE=${{ matrix.suite }} node report.js + - name: docker logs + if: always() + run: tests/docker_logs.sh + - name: Archive docker test artifacts uses: actions/upload-artifact@v3 if: always() @@ -529,6 +533,10 @@ jobs: timeout-minutes: 10 run: make test-upgrade VERSION=${{ matrix.version }} TO_VERSION=${{ env.env_file }} + - name: docker logs + if: always() + run: tests/docker_logs.sh + - name: Archive docker test artifacts uses: actions/upload-artifact@v3 if: always() @@ -565,6 +573,10 @@ jobs: timeout-minutes: 10 run: make test-upgrade VERSION=${{ matrix.version }} TO_VERSION=${{ env.env_file }} + - name: docker logs + if: always() + run: tests/docker_logs.sh + - name: Archive docker test artifacts uses: actions/upload-artifact@v3 if: always() From dee8cd675e186ba13d6c14ef96d9f09b2c3b6991 Mon Sep 17 00:00:00 2001 From: addshore Date: Thu, 22 Sep 2022 17:50:08 +0200 Subject: [PATCH 2/4] fix path --- .github/workflows/built_and_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/built_and_test.yml b/.github/workflows/built_and_test.yml index ac035d4c5..0171655f9 100644 --- a/.github/workflows/built_and_test.yml +++ b/.github/workflows/built_and_test.yml @@ -492,7 +492,7 @@ jobs: - name: docker logs if: always() - run: tests/docker_logs.sh + run: test/docker_logs.sh - name: Archive docker test artifacts uses: actions/upload-artifact@v3 @@ -535,7 +535,7 @@ jobs: - name: docker logs if: always() - run: tests/docker_logs.sh + run: test/docker_logs.sh - name: Archive docker test artifacts uses: actions/upload-artifact@v3 @@ -575,7 +575,7 @@ jobs: - name: docker logs if: always() - run: tests/docker_logs.sh + run: test/docker_logs.sh - name: Archive docker test artifacts uses: actions/upload-artifact@v3 From 0c5779e66f343e663b0bf732eec1843bb38e3ba5 Mon Sep 17 00:00:00 2001 From: addshore Date: Thu, 22 Sep 2022 18:25:21 +0200 Subject: [PATCH 3/4] Actually add file --- test/docker_logs.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 test/docker_logs.sh diff --git a/test/docker_logs.sh b/test/docker_logs.sh new file mode 100755 index 000000000..58d06bc62 --- /dev/null +++ b/test/docker_logs.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# run `docker logs` for all containers +# Used in CI for outputing all logs when a run has failed +set -e + +for container in $(docker ps --all | awk '{if(NR>1) print $NF}') +do + echo "Container: $container" + docker logs $container +done \ No newline at end of file From 6a7576a80d8979147170b43be8f924044a741cd5 Mon Sep 17 00:00:00 2001 From: addshore Date: Thu, 22 Sep 2022 18:28:46 +0200 Subject: [PATCH 4/4] Fix SC2086 --- test/docker_logs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/docker_logs.sh b/test/docker_logs.sh index 58d06bc62..184a9693c 100755 --- a/test/docker_logs.sh +++ b/test/docker_logs.sh @@ -6,5 +6,5 @@ set -e for container in $(docker ps --all | awk '{if(NR>1) print $NF}') do echo "Container: $container" - docker logs $container + docker logs "$container" done \ No newline at end of file