From 37713ddfaec746d139a22fe7816a536b9d57aad0 Mon Sep 17 00:00:00 2001 From: yatinappsmith <84702014+yatinappsmith@users.noreply.github.com> Date: Mon, 3 Oct 2022 09:28:17 +0530 Subject: [PATCH] ci: Add retry for fat container (#16973) --- .../workflows/integration-tests-command.yml | 55 ++++++++++++---- .github/workflows/test-build-docker-image.yml | 65 ++++++++++++++----- 2 files changed, 93 insertions(+), 27 deletions(-) diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml index 07b5f665f1..73affc3f1e 100644 --- a/.github/workflows/integration-tests-command.yml +++ b/.github/workflows/integration-tests-command.yml @@ -111,8 +111,8 @@ jobs: uses: martijnhols/actions-cache/restore@v3 with: path: | - ~/combined_failed_spec - key: ${{ github.run_id }}-"ui-test-result"-${{ steps.timestamp.outputs.timestamp }} + ~/combined_failed_spec_fat + key: ${{ github.run_id }}-"ui-test-result" restore-keys: | ${{ github.run_id }}-${{ github.job }} @@ -121,7 +121,7 @@ jobs: - name: Get failed_spec if: steps.run_result.outputs.run_result == 'failedtest' run: | - failed_spec_env=$(cat ~/combined_failed_spec) + failed_spec_env=$(cat ~/combined_failed_spec_fat) echo "failed_spec_env<> $GITHUB_ENV echo "$failed_spec_env" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV @@ -341,28 +341,28 @@ jobs: if: failure() run: echo "::set-output name=run_result::failedtest" > ~/run_result - # Create a directory ~/failed_spec and add a dummy file + # Create a directory ~/failed_spec_fat and add a dummy file # This will ensure upload and download steps are successfull - name: Create direcotrs for failed tests if: always() run: | - mkdir -p ~/failed_spec - echo "empty" >> ~/failed_spec/dummy-${{ matrix.job }} + mkdir -p ~/failed_spec_fat + echo "empty" >> ~/failed_spec_fat/dummy-${{ matrix.job }} # add list failed tests to a file - name: Incase of test failures copy them to a file if: failure() run: | cd ${{ github.workspace }}/app/client/cypress/ - find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec/failed_spec-${{ matrix.job }} + find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec_fat/failed_spec-${{ matrix.job }} # Upload failed test list using common path for all matrix job - name: Upload failed test list artifact if: always() uses: actions/upload-artifact@v2 with: - name: failed-spec - path: ~/failed_spec + name: failed-spec-fat + path: ~/failed_spec_fat # Force store previous run result to cache - name: Store the previous run result @@ -381,7 +381,7 @@ jobs: uses: martijnhols/actions-cache/save@v3 with: path: | - ~/failed_spec + ~/failed_spec_fat key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} restore-keys: | ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} @@ -398,7 +398,7 @@ jobs: with: path: | app/client/cypress/snapshots/ - key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }} + key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} restore-keys: | ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} @@ -821,11 +821,24 @@ jobs: with: name: failed-spec path: ~/failed_spec + + # Download failed_spec list for all jobs + - uses: actions/download-artifact@v2 + if: needs.ui-test.result + id: download + with: + name: failed-spec-fat + path: ~/failed_spec_fat # Incase for any uti-test job failure, create combined failed spec - name: "combine all specs" if: needs.ui-test.result != 'success' run: cat ~/failed_spec/failed_spec* >> ~/combined_failed_spec + + # Incase for any fat-container job failure, create combined failed spec + - name: "combine all specs for fat" + if: needs.ui-test.result != 'success' + run: cat ~/failed_spec_fat/failed_spec_fat* >> ~/combined_failed_spec_fat # Force save the failed spec list into a cache - name: Store the combined run result @@ -837,6 +850,17 @@ jobs: key: ${{ github.run_id }}-"ui-test-result" restore-keys: | ${{ github.run_id }}-${{ github.job }} + + # Force save the fat failed spec list into a cache + - name: Store the combined run result for fat + if: needs.ui-test.result + uses: martijnhols/actions-cache/save@v3 + with: + path: | + ~/combined_failed_spec_fat + key: ${{ github.run_id }}-"ui-test-result" + restore-keys: | + ${{ github.run_id }}-${{ github.job }} # Upload combined failed spec list to a file # This is done for debugging. @@ -846,6 +870,15 @@ jobs: with: name: combined_failed_spec path: ~/combined_failed_spec + + # Upload combined failed fat spec list to a file + # This is done for debugging. + - name: upload combined failed spec + if: needs.ui-test.result + uses: actions/upload-artifact@v2 + with: + name: combined_failed_spec_fat + path: ~/combined_failed_spec_fat # Update check run called "ui-test-result" - name: Mark ui-test-result job as complete diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml index f5a7638692..ec6c76101a 100644 --- a/.github/workflows/test-build-docker-image.yml +++ b/.github/workflows/test-build-docker-image.yml @@ -665,7 +665,7 @@ jobs: with: path: | ~/run_result - key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }} + key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} restore-keys: | ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} @@ -680,8 +680,8 @@ jobs: uses: martijnhols/actions-cache/restore@v3 with: path: | - ~/combined_failed_spec - key: ${{ github.run_id }}-"ui-test-result"-${{ steps.timestamp.outputs.timestamp }} + ~/combined_failed_spec_fat + key: ${{ github.run_id }}-"ui-test-result" restore-keys: | ${{ github.run_id }}-${{ github.job }} @@ -690,7 +690,7 @@ jobs: - name: Get failed_spec if: steps.run_result.outputs.run_result == 'failedtest' run: | - failed_spec_env=$(cat ~/combined_failed_spec) + failed_spec_env=$(cat ~/combined_failed_spec_fat) echo "failed_spec_env<> $GITHUB_ENV echo "$failed_spec_env" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV @@ -910,28 +910,28 @@ jobs: if: failure() run: echo "::set-output name=run_result::failedtest" > ~/run_result - # Create a directory ~/failed_spec and add a dummy file + # Create a directory ~/failed_spec_fat and add a dummy file # This will ensure upload and download steps are successfull - - name: Create direcotrs for failed tests + - name: Create directories for failed tests if: always() run: | - mkdir -p ~/failed_spec - echo "empty" >> ~/failed_spec/dummy-${{ matrix.job }} + mkdir -p ~/failed_spec_fat + echo "empty" >> ~/failed_spec_fat/dummy-${{ matrix.job }} # add list failed tests to a file - name: Incase of test failures copy them to a file if: failure() run: | cd ${{ github.workspace }}/app/client/cypress/ - find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec/failed_spec-${{ matrix.job }} + find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec_fat/failed_spec_fat-${{ matrix.job }} # Upload failed test list using common path for all matrix job - name: Upload failed test list artifact if: always() uses: actions/upload-artifact@v2 with: - name: failed-spec - path: ~/failed_spec + name: failed-spec-fat + path: ~/failed_spec_fat # Force store previous run result to cache - name: Store the previous run result @@ -940,7 +940,7 @@ jobs: with: path: | ~/run_result - key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }} + key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} restore-keys: | ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} @@ -950,8 +950,8 @@ jobs: uses: martijnhols/actions-cache/save@v3 with: path: | - ~/failed_spec - key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }} + ~/failed_spec_fat + key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} restore-keys: | ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} @@ -967,7 +967,7 @@ jobs: with: path: | app/client/cypress/snapshots/ - key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }} + key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} restore-keys: | ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }} @@ -1443,11 +1443,24 @@ jobs: with: name: failed-spec path: ~/failed_spec + + # Download failed_spec_fat list for all fat container jobs + - uses: actions/download-artifact@v2 + if: needs.fat-container-test.result + id: download + with: + name: failed-spec-fat + path: ~/failed_spec_fat - # Incase for any uti-test job failure, create combined failed spec + # Incase for any ui-test job failure, create combined failed spec - name: "combine all specs" if: needs.ui-test.result != 'success' run: cat ~/failed_spec/failed_spec* >> ~/combined_failed_spec + + # Incase for any fat-container job failure, create combined failed spec + - name: "combine all specs for fat" + if: needs.ui-test.result != 'success' + run: cat ~/failed_spec_fat/failed_spec_fat* >> ~/combined_failed_spec_fat # Force save the failed spec list into a cache - name: Store the combined run result @@ -1460,6 +1473,17 @@ jobs: restore-keys: | ${{ github.run_id }}-${{ github.job }} + # Force save the fat failed spec list into a cache + - name: Store the combined run result for fat + if: needs.ui-test.result + uses: martijnhols/actions-cache/save@v3 + with: + path: | + ~/combined_failed_spec_fat + key: ${{ github.run_id }}-"ui-test-result" + restore-keys: | + ${{ github.run_id }}-${{ github.job }} + # Upload combined failed spec list to a file # This is done for debugging. - name: upload combined failed spec @@ -1468,6 +1492,15 @@ jobs: with: name: combined_failed_spec path: ~/combined_failed_spec + + # Upload combined failed fat spec list to a file + # This is done for debugging. + - name: upload combined failed spec + if: needs.ui-test.result + uses: actions/upload-artifact@v2 + with: + name: combined_failed_spec_fat + path: ~/combined_failed_spec_fat - name: Return status for ui-matrix run: |