From d1f37ff15662237853ab074852ae0022b651cf18 Mon Sep 17 00:00:00 2001 From: Andreas Thaler Date: Thu, 22 Aug 2024 18:34:05 +0200 Subject: [PATCH] chore: Collect JUnit reports as part of gingko executions (#1365) --- .github/template/finalize-test/action.yaml | 8 ++++++++ .github/workflows/branch-integration.yml | 7 +++++++ .github/workflows/pr-integration.yml | 14 +++++++++----- .github/workflows/pr-lifecycle.yml | 5 +++-- hack/gardener-integration-test.sh | 2 +- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/template/finalize-test/action.yaml b/.github/template/finalize-test/action.yaml index d71626c2d..2000d3a4d 100644 --- a/.github/template/finalize-test/action.yaml +++ b/.github/template/finalize-test/action.yaml @@ -5,11 +5,19 @@ inputs: failure: description: Are we in failure mode? required: true + job-name: + description: The name of the job + required: false runs: using: "composite" steps: + - name: Upload Report + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.job-name }}-report + path: junit-report*.xml - name: Describe manager pod shell: bash diff --git a/.github/workflows/branch-integration.yml b/.github/workflows/branch-integration.yml index 642e1bd25..a29975070 100644 --- a/.github/workflows/branch-integration.yml +++ b/.github/workflows/branch-integration.yml @@ -46,6 +46,13 @@ jobs: GARDENER_PROJECT: ${{ secrets.GARDENER_PROJECT }} GARDENER_SA_PATH: /tmp/gardener-sa.yaml GARDENER_K8S_VERSION: ${{ matrix.k8s_version }} + + - name: Upload Report + uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: ${{ github.job }}-report + path: junit-report*.xml - name: Send slack message on failure uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 diff --git a/.github/workflows/pr-integration.yml b/.github/workflows/pr-integration.yml index 7cc01b472..f2eed0619 100644 --- a/.github/workflows/pr-integration.yml +++ b/.github/workflows/pr-integration.yml @@ -37,13 +37,14 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run tests - run: bin/ginkgo run --tags e2e --label-filter="${{ matrix.ginkgo-labels }} && !experimental" test/e2e + run: bin/ginkgo run --junit-report=junit-report.xml --tags e2e --label-filter="${{ matrix.ginkgo-labels }} && !experimental" test/e2e - name: Finalize test uses: "./.github/template/finalize-test" if: success() || failure() with: failure: failure() + job-name: ${{ github.job }}-${{ matrix.ginkgo-labels }} e2e-dev: strategy: @@ -64,13 +65,14 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run tests - run: bin/ginkgo run --tags e2e --label-filter="${{ matrix.ginkgo-labels }} && experimental" test/e2e + run: bin/ginkgo run --junit-report=junit-report.xml --tags e2e --label-filter="${{ matrix.ginkgo-labels }} && experimental" test/e2e - name: Finalize test uses: "./.github/template/finalize-test" if: success() || failure() with: failure: failure() + job-name: ${{ github.job }}-${{ matrix.ginkgo-labels }} e2e-istio: runs-on: ubuntu-latest @@ -89,13 +91,14 @@ jobs: - name: Run tests run: | - bin/ginkgo run --tags istio --label-filter="integration" test/integration/istio + bin/ginkgo run --junit-report=junit-report.xml --tags istio --label-filter="integration" test/integration/istio - name: Finalize Test uses: "./.github/template/finalize-test" if: success() || failure() with: failure: failure() + job-name: ${{ github.job }} e2e-self-mon: strategy: @@ -123,7 +126,7 @@ jobs: - name: Run tests without Istio if: ${{ matrix.scenario == 'healthy' }} run: | - bin/ginkgo run --tags e2e --label-filter="self-mon-${{ matrix.signal-type }}-${{ matrix.scenario }}" test/e2e + bin/ginkgo run --junit-report=junit-report-healthy.xml --tags e2e --label-filter="self-mon-${{ matrix.signal-type }}-${{ matrix.scenario }}" test/e2e # we need Istio for fault injection to simulate backpressure and outages - name: Deploy Istio Module @@ -133,13 +136,14 @@ jobs: - name: Run tests with Istio if: ${{ matrix.scenario != 'healthy' }} run: | - bin/ginkgo run --tags istio --label-filter="self-mon-${{ matrix.signal-type }}-${{ matrix.scenario }}" test/integration/istio + bin/ginkgo run --junit-report=junit-report-unhealthy.xml --tags istio --label-filter="self-mon-${{ matrix.signal-type }}-${{ matrix.scenario }}" test/integration/istio - name: Finalize Test uses: "./.github/template/finalize-test" if: success() || failure() with: failure: failure() + job-name: ${{ github.job }}-${{ matrix.signal-type }}-${{ matrix.scenario }} PR-Integration-Success: needs: [e2e, e2e-dev, e2e-istio, e2e-self-mon] diff --git a/.github/workflows/pr-lifecycle.yml b/.github/workflows/pr-lifecycle.yml index cb9985e8f..5a6058fce 100644 --- a/.github/workflows/pr-lifecycle.yml +++ b/.github/workflows/pr-lifecycle.yml @@ -43,7 +43,7 @@ jobs: - name: Run test on latest tag shell: bash run: | - bin/ginkgo run --tags e2e --flake-attempts=5 --label-filter="operational" -v test/e2e + bin/ginkgo run --junit-report=junit-report-latest-version.xml --tags e2e --flake-attempts=5 --label-filter="operational" -v test/e2e - name: Wait for cleanup of test run shell: bash @@ -72,13 +72,14 @@ jobs: shell: bash run: | make install-tools # delete after the tools via go modules are released - bin/ginkgo run --tags e2e --flake-attempts=5 --label-filter="operational" -v test/e2e + bin/ginkgo run --junit-report=junit-report-current-version.xml --tags e2e --flake-attempts=5 --label-filter="operational" -v test/e2e - name: Finalize test uses: "./.github/template/finalize-test" if: success() || failure() with: failure: failure() + job-name: ${{ github.job }} PR-Lifecycle-Success: needs: manager-upgrade diff --git a/hack/gardener-integration-test.sh b/hack/gardener-integration-test.sh index 71dc8adea..3abb4587c 100755 --- a/hack/gardener-integration-test.sh +++ b/hack/gardener-integration-test.sh @@ -17,7 +17,7 @@ function run-tests-with-git-image () { make ginkgo make deploy hack/deploy-istio.sh - ${GINKGO} run --tags istio --label-filter="integration" test/integration/istio + ${GINKGO} run --junit-report=junit-report.xml --tags istio --label-filter="integration" test/integration/istio } function main() {