From 679acff61385588852f785cf085dc9211d452bec Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Fri, 27 Sep 2024 10:00:45 +0200 Subject: [PATCH] Display junit results Issue: ZENKO-4876 --- .github/actions/archive-artifacts/action.yaml | 73 +++++++++- .github/actions/debug-wait/action.yaml | 1 + .github/workflows/end2end.yaml | 136 +++--------------- 3 files changed, 92 insertions(+), 118 deletions(-) diff --git a/.github/actions/archive-artifacts/action.yaml b/.github/actions/archive-artifacts/action.yaml index f5770a836a..fca9682ccf 100644 --- a/.github/actions/archive-artifacts/action.yaml +++ b/.github/actions/archive-artifacts/action.yaml @@ -2,9 +2,55 @@ name: Archive artifact logs and data description: Archive logs, pods and events +inputs: + junit-paths: + description: 'Path to junit reports' + default: '/artifacts/data/reports/*.xml' + required: true + stage: + description: 'Stage name' + default: ${{ github.job }}${{ github.run_attempt > 1 && format(".%d", github.run_attempt) || "" }} + required: true + trunk_token: + description: 'Trunk token' + required: false + zenko-name: + description: 'Zenko name' + default: 'end2end' + required: false + zenko-namespace: + description: 'Namespace' + default: 'default' + required: false + runs: using: composite steps: + - name: test #TODO: remove before merge + shell: bash + run: |- + echo "job: ${{ github.job }}" + echo "job status: ${{ job.status }}" + echo "job failure(): ${{ failure() }}" + echo "job cancelled(): ${{ cancelled() }}" + echo "STAGE: ${{ inputs.stage }}" + continue-on-error: true + + - name: Publish test report + uses: mikepenz/action-junit-report@v4 + with: + report_paths: ${{ inputs.junit-paths }} + continue-on-error: true + + - name: Upload results + if: inputs.trunk_token && job.status!="cancelled" + uses: trunk-io/analytics-uploader@v1.4.0 + with: + junit-paths: ${{ inputs.junit-paths }} + org-slug: ${{ github.repository_owner }} + token: ${{ inputs.trunk_token }} + continue-on-error: true + - name: Archive artifact logs and data shell: bash run: |- @@ -16,15 +62,18 @@ runs: kubectl get zenkodrsource -A -o yaml > /tmp/artifacts/data/${STAGE}/kind-logs/all-zenkodrsources.log; kubectl get zenkodrsink -A -o yaml > /tmp/artifacts/data/${STAGE}/kind-logs/all-zenkodrsinks.log; kind export logs /tmp/artifacts/data/${STAGE}/kind-logs/kind-export; - tar zcvf /tmp/artifacts/${{ github.sha }}-${STAGE}-logs-volumes.tgz /tmp/artifacts/data/${STAGE}/kind-logs; + tar zcvf /tmp/artifacts/${{ github.sha }}-${STAGE}-logs-volumes.tgz + /tmp/artifacts/data/${STAGE}/kind-logs; + env: + STAGE: ${{ inputs.stage }} + continue-on-error: true + - name: Dump kafka shell: bash - continue-on-error: true run: |- set -exu - NAMESPACE=${NAMESPACE:-default} - KAFKA=$(kubectl get pods -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME:-end2end}-base-queue -o jsonpath='{.items[0].metadata.name}') + KAFKA=$(kubectl get pods -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME}-base-queue -o jsonpath='{.items[0].metadata.name}') kubectl exec -in ${NAMESPACE} ${KAFKA} -c kafka -- \ env KAFKA_OPTS= kafka-topics.sh --bootstrap-server :9092 --list \ @@ -38,10 +87,24 @@ runs: env KAFKA_OPTS= kafka-consumer-groups.sh --bootstrap-server :9092 --describe --all-groups \ > /tmp/artifacts/data/${STAGE}/kafka-offsets.log - KAFKA_SERVICE=$(kubectl get services -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME:-end2end}-base-queue -o jsonpath='{.items[0].metadata.name}') + KAFKA_SERVICE=$(kubectl get services -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME}-base-queue -o jsonpath='{.items[0].metadata.name}') kubectl run -n ${NAMESPACE} kcat --image=edenhill/kcat:1.7.1 --restart=Never --command -- sleep 300 kubectl wait -n ${NAMESPACE} pod kcat --for=condition=ready cat /tmp/artifacts/data/${STAGE}/kafka-topics.log | grep -v '^__' | xargs -P 15 -I {} \ sh -c "kubectl exec -i -n ${NAMESPACE} kcat -- \ kcat -L -b ${KAFKA_SERVICE} -t {} -C -o beginning -e -q -J \ > /tmp/artifacts/data/${STAGE}/kafka-messages-{}.log" + env: + STAGE: ${{ inputs.stage }} + NAMESPACE: ${{ inputs.zenko-namespace }} + ZENKO_NAME: ${{ inputs.zenko-name }} + continue-on-error: true + + - name: Upload artifacts # move into `archive-artifacts` action + uses: scality/action-artifacts@v4 + with: + method: upload + url: https://artifacts.scality.net + user: ${{ inputs.artifacts-user }} + password: ${{ inputs.artifacts-password }} + source: /tmp/artifacts diff --git a/.github/actions/debug-wait/action.yaml b/.github/actions/debug-wait/action.yaml index 9f63f120dd..8549d78d51 100644 --- a/.github/actions/debug-wait/action.yaml +++ b/.github/actions/debug-wait/action.yaml @@ -13,3 +13,4 @@ runs: tmate-server-port: ${{ env.TMATE_SERVER_PORT }} tmate-server-rsa-fingerprint: ${{ env.TMATE_SERVER_RSA_FINGERPRINT }} tmate-server-ed25519-fingerprint: ${{ env.TMATE_SERVER_ED25519_FINGERPRINT }} + if: job.status == 'failure' && runner.debug == '1' diff --git a/.github/workflows/end2end.yaml b/.github/workflows/end2end.yaml index 41ccc4ed01..5f0f2fee8b 100644 --- a/.github/workflows/end2end.yaml +++ b/.github/workflows/end2end.yaml @@ -416,33 +416,15 @@ jobs: - name: Debug wait uses: ./.github/actions/debug-wait timeout-minutes: 60 - if: failure() && runner.debug == '1' - - name: Upload results - if: "!cancelled() && env.TRUNK_TOKEN" - uses: trunk-io/analytics-uploader@main - with: - junit-paths: /artifacts/data/reports/*.xml - org-slug: ${{ github.repository_owner }} - token: ${{ env.TRUNK_TOKEN }} - env: - TRUNK_TOKEN: ${{ secrets.TRUNK_TOKEN }} - continue-on-error: true - - name: Archive artifact logs and data + - name: Archive and publish artifacts uses: ./.github/actions/archive-artifacts - env: - STAGE: ${{ github.job }}.${{ github.run_attempt }} - if: always() - - name: Clean Up - run: kind delete cluster - - name: Upload artifacts - uses: scality/action-artifacts@v4 with: - method: upload - url: https://artifacts.scality.net user: ${{ secrets.ARTIFACTS_USER }} password: ${{ secrets.ARTIFACTS_PASSWORD }} - source: /tmp/artifacts + trunk_token: ${{ secrets.TRUNK_TOKEN }} if: always() + - name: Clean Up + run: kind delete cluster end2end-pra: needs: [build-kafka, check-dashboard-versions, lint-and-build-ctst] @@ -493,33 +475,15 @@ jobs: - name: Debug wait uses: ./.github/actions/debug-wait timeout-minutes: 60 - if: failure() && runner.debug == '1' - - name: Upload results - if: env.TRUNK_TOKEN && !cancelled() - uses: trunk-io/analytics-uploader@main - with: - junit-paths: /artifacts/data/reports/*.xml - org-slug: ${{ github.repository_owner }} - token: ${{ env.TRUNK_TOKEN }} - env: - TRUNK_TOKEN: ${{ secrets.TRUNK_TOKEN }} - continue-on-error: true - - name: Archive artifact logs and data + - name: Archive and publish artifacts uses: ./.github/actions/archive-artifacts - env: - STAGE: ${{ github.job }}.${{ github.run_attempt }} - if: always() - - name: Clean Up - run: kind delete cluster - - name: Upload artifacts - uses: scality/action-artifacts@v4 with: - method: upload - url: https://artifacts.scality.net user: ${{ secrets.ARTIFACTS_USER }} password: ${{ secrets.ARTIFACTS_PASSWORD }} - source: /tmp/artifacts + trunk_token: ${{ secrets.TRUNK_TOKEN }} if: always() + - name: Clean Up + run: kind delete cluster end2end-https: needs: [build-kafka, build-test-image, check-dashboard-versions] @@ -554,41 +518,23 @@ jobs: - name: Run smoke tests run: bash run-e2e-test.sh "end2end" ${E2E_IMAGE_NAME}:${E2E_IMAGE_TAG} "smoke" "default" working-directory: ./.github/scripts/end2end - - name: Debug wait - uses: ./.github/actions/debug-wait - timeout-minutes: 60 - if: failure() && runner.debug == '1' - - name: Upload results - if: env.TRUNK_TOKEN && !cancelled() - uses: trunk-io/analytics-uploader@main - with: - junit-paths: /artifacts/data/reports/*.xml - org-slug: ${{ github.repository_owner }} - token: ${{ env.TRUNK_TOKEN }} - env: - TRUNK_TOKEN: ${{ secrets.TRUNK_TOKEN }} - continue-on-error: true # Temporarily disabled as CTST will test the same APIs more # extensively. # - name: Run vault e2e tests # run: bash vault-e2e-test.sh # working-directory: ./.github/scripts/end2end - - name: Archive artifact logs and data + - name: Debug wait + uses: ./.github/actions/debug-wait + timeout-minutes: 60 + - name: Archive and publish artifacts uses: ./.github/actions/archive-artifacts - env: - STAGE: ${{ github.job }}.${{ github.run_attempt }} - if: always() - - name: Clean Up - run: kind delete cluster - - name: Upload artifacts - uses: scality/action-artifacts@v4 with: - method: upload - url: https://artifacts.scality.net user: ${{ secrets.ARTIFACTS_USER }} password: ${{ secrets.ARTIFACTS_PASSWORD }} - source: /tmp/artifacts + trunk_token: ${{ secrets.TRUNK_TOKEN }} if: always() + - name: Clean Up + run: kind delete cluster end2end-sharded: needs: [build-kafka, build-test-image, check-dashboard-versions] @@ -616,36 +562,18 @@ jobs: - name: Run backbeat end to end tests run: bash run-e2e-test.sh "end2end" ${E2E_IMAGE_NAME}:${E2E_IMAGE_TAG} "backbeat" "default" working-directory: ./.github/scripts/end2end - - name: Upload results - if: env.TRUNK_TOKEN && !cancelled() - uses: trunk-io/analytics-uploader@main - with: - junit-paths: /artifacts/data/reports/*.xml - org-slug: ${{ github.repository_owner }} - token: ${{ env.TRUNK_TOKEN }} - env: - TRUNK_TOKEN: ${{ secrets.TRUNK_TOKEN }} - continue-on-error: true - name: Debug wait uses: ./.github/actions/debug-wait timeout-minutes: 60 - if: failure() && runner.debug == '1' - - name: Archive artifact logs and data + - name: Archive and publish artifacts uses: ./.github/actions/archive-artifacts - env: - STAGE: ${{ github.job }}.${{ github.run_attempt }} - if: always() - - name: Clean Up - run: kind delete cluster - - name: Upload artifacts - uses: scality/action-artifacts@v4 with: - method: upload - url: https://artifacts.scality.net user: ${{ secrets.ARTIFACTS_USER }} password: ${{ secrets.ARTIFACTS_PASSWORD }} - source: /tmp/artifacts + trunk_token: ${{ secrets.TRUNK_TOKEN }} if: always() + - name: Clean Up + run: kind delete cluster ctst-end2end-sharded: needs: [build-kafka, lint-and-build-ctst, check-dashboard-versions] @@ -680,36 +608,18 @@ jobs: - name: Run CTST end to end tests run: bash run-e2e-ctst.sh "" "" "" "" --tags 'not @PRA' working-directory: ./.github/scripts/end2end - - name: Upload results - if: env.TRUNK_TOKEN && !cancelled() - uses: trunk-io/analytics-uploader@main - with: - junit-paths: /artifacts/data/reports/*.xml - org-slug: ${{ github.repository_owner }} - token: ${{ env.TRUNK_TOKEN }} - env: - TRUNK_TOKEN: ${{ secrets.TRUNK_TOKEN }} - continue-on-error: true - name: Debug wait uses: ./.github/actions/debug-wait timeout-minutes: 60 - if: failure() && runner.debug == '1' - - name: Archive artifact logs and data + - name: Archive and publish artifacts uses: ./.github/actions/archive-artifacts - env: - STAGE: ${{ github.job }}.${{ github.run_attempt }} - if: always() - - name: Clean Up - run: kind delete cluster - - name: Upload artifacts - uses: scality/action-artifacts@v4 with: - method: upload - url: https://artifacts.scality.net user: ${{ secrets.ARTIFACTS_USER }} password: ${{ secrets.ARTIFACTS_PASSWORD }} - source: /tmp/artifacts + trunk_token: ${{ secrets.TRUNK_TOKEN }} if: always() + - name: Clean Up + run: kind delete cluster write-final-status: runs-on: ubuntu-latest