diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 0b1dfa79250..f043b9778fd 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -38,10 +38,6 @@ jobs: id: test-execution run: bash scripts/kafka-integration-test.sh -j ${{ matrix.jaeger-version }} - - name: Output Kafka logs on failure - run: docker compose -f ${{ steps.test-execution.outputs.docker_compose_file }} logs - if: ${{ failure() }} - - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/scripts/kafka-integration-test.sh b/scripts/kafka-integration-test.sh index b46e809ff45..eecaaf2092d 100755 --- a/scripts/kafka-integration-test.sh +++ b/scripts/kafka-integration-test.sh @@ -10,6 +10,7 @@ echo "docker_compose_file=${compose_file}" >> "${GITHUB_OUTPUT:-/dev/null}" jaeger_version="" manage_kafka="true" +success="false" print_help() { echo "Usage: $0 [-K] -j " @@ -43,7 +44,16 @@ setup_kafka() { docker compose -f "${compose_file}" up -d kafka } +dump_logs() { + echo "::group::Kafka logs" + docker compose -f "${compose_file}" logs + echo "::endgroup::" +} + teardown_kafka() { + if [[ "$success" == "false" ]]; then + dump_logs + fi echo "Stopping Kafka..." docker compose -f "${compose_file}" down } @@ -98,6 +108,8 @@ main() { wait_for_kafka run_integration_test + + success="true" } main "$@"