From 5abe543210dd97d6bfca24463b4757414525762c Mon Sep 17 00:00:00 2001 From: Oleg Ivaniv Date: Fri, 21 Apr 2023 13:12:54 +0200 Subject: [PATCH] Set e2e-reusable output and check all container state --- .github/workflows/e2e-reusable.yml | 24 ++++++++++++++++++++++++ .github/workflows/e2e-tests-pr.yml | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-reusable.yml b/.github/workflows/e2e-reusable.yml index 7b02765d37f40..df2b04a058d74 100644 --- a/.github/workflows/e2e-reusable.yml +++ b/.github/workflows/e2e-reusable.yml @@ -47,6 +47,11 @@ on: CYPRESS_RECORD_KEY: description: 'Cypress record key.' required: true + outputs: + tests_passed: + description: 'True if all E2E tests passed, otherwise false' + value: ${{ jobs.check_testing_matrix.outputs.all_tests_passed }} + jobs: # single job that generates and outputs a common id @@ -150,3 +155,22 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} E2E_TESTS: true COMMIT_INFO_MESSAGE: 🌳 ${{ inputs.branch }} 🖥️ ${{ inputs.run-env }} 🤖 ${{ inputs.user }} 🗃️ ${{ inputs.spec }} + + # Check if all tests passed and set the output variable + check_testing_matrix: + runs-on: ubuntu-latest + needs: [testing] + outputs: + all_tests_passed: ${{ steps.all_tests_passed.outputs.result }} + steps: + - name: Check all tests passed + id: all_tests_passed + run: | + success=true + for status in ${{ needs.testing.result }}; do + if [ $status != "success" ]; then + success=false + break + fi + done + echo "::set-output name=result::$success" diff --git a/.github/workflows/e2e-tests-pr.yml b/.github/workflows/e2e-tests-pr.yml index 734ef7d69e536..648383750d1ab 100644 --- a/.github/workflows/e2e-tests-pr.yml +++ b/.github/workflows/e2e-tests-pr.yml @@ -26,7 +26,7 @@ jobs: if: always() steps: - name: E2E success comment - if: ${{!contains(github.event.pull_request.labels.*.name, 'community') && needs.run-e2e-tests.result == 'success' }} + if: ${{!contains(github.event.pull_request.labels.*.name, 'community') && needs.run-e2e-tests.outputs.tests_passed == 'true' }} uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ github.event.pull_request.number }}