From 0a6fc90c63008dd4e973497655db86dfc82295d6 Mon Sep 17 00:00:00 2001 From: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:22:14 +0530 Subject: [PATCH 1/4] Fix process load test results workflow --- .../process-load-test-results-template.yml | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/process-load-test-results-template.yml b/.github/workflows/process-load-test-results-template.yml index 448748a5..cc1f333d 100644 --- a/.github/workflows/process-load-test-results-template.yml +++ b/.github/workflows/process-load-test-results-template.yml @@ -58,9 +58,21 @@ jobs: done env: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} + - name: Check if the load-test-results branch exists + if: ${{ steps.processResults.outputs.hasPassed }} + id: check_branch + run: | + if git ls-remote --heads origin load-test-results | grep -q "refs/heads/load-test-results"; then + echo "branch_exists=true" >> $GITHUB_ENV + else + echo "branch_exists=false" >> $GITHUB_ENV + fi + - name: Delete existing load-test-results branch + if: ${{ steps.check_branch.outputs.branch_exists }} + run: git push origin --delete load-test-results - name: Push results if: ${{ steps.processResults.outputs.hasPassed }} - run: git push origin "load-test-results" + run: git push origin load-test-results env: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} - name: Create pull request for new summary @@ -95,22 +107,8 @@ jobs: - name: Merge PR if: ${{ steps.processResults.outputs.hasPassed }} run: | - if [[ ${{ steps.processResults.outputs.branch }} == "null" ]] - then - checkCount="0" - while [ "$checkCount" != "3" ] - do - sleep 20 - checkCount=$(gh pr status --jq '[.currentBranch .statusCheckRollup[] | select((.conclusion=="SUCCESS") and ((.name=="Run PR Build Workflow / Build on Ubuntu") or (.name=="Run PR Build Workflow / Build on Windows") or (.name=="codecov/project")))] | length' --json statusCheckRollup) - failedCount=$(gh pr status --jq '[.currentBranch .statusCheckRollup[] | select((.conclusion=="FAILURE") and ((.name=="Run PR Build Workflow / Build on Ubuntu") or (.name=="Run PR Build Workflow / Build on Windows") or (.name=="codecov/project")))]|length' --json statusCheckRollup) - if [[ "$failedCount" != "0" ]] - then - echo "PR Build has failed" - exit 1 - fi - done - sleep 20 - fi + gh pr checks ${{ steps.createPR.outputs.prUrl }} --required --watch --interval 20 + sleep 5 gh pr merge ${{ steps.createPR.outputs.prUrl }} --merge --delete-branch env: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} From 95d52dcc46b192a426ab5daac091d119ac56afe4 Mon Sep 17 00:00:00 2001 From: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:28:57 +0530 Subject: [PATCH 2/4] Apply suggestions from code review --- .github/workflows/process-load-test-results-template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/process-load-test-results-template.yml b/.github/workflows/process-load-test-results-template.yml index cc1f333d..fa2df054 100644 --- a/.github/workflows/process-load-test-results-template.yml +++ b/.github/workflows/process-load-test-results-template.yml @@ -58,7 +58,7 @@ jobs: done env: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} - - name: Check if the load-test-results branch exists + - name: Check the existence of load-test-results branch if: ${{ steps.processResults.outputs.hasPassed }} id: check_branch run: | @@ -67,7 +67,7 @@ jobs: else echo "branch_exists=false" >> $GITHUB_ENV fi - - name: Delete existing load-test-results branch + - name: Delete the existing load-test-results branch if: ${{ steps.check_branch.outputs.branch_exists }} run: git push origin --delete load-test-results - name: Push results From 3dbb31dcbab535b67451236449d47a052fd96b2e Mon Sep 17 00:00:00 2001 From: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:24:15 +0530 Subject: [PATCH 3/4] Remove existing branch deleting step --- .../workflows/process-load-test-results-template.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/process-load-test-results-template.yml b/.github/workflows/process-load-test-results-template.yml index fa2df054..6035071b 100644 --- a/.github/workflows/process-load-test-results-template.yml +++ b/.github/workflows/process-load-test-results-template.yml @@ -58,18 +58,6 @@ jobs: done env: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} - - name: Check the existence of load-test-results branch - if: ${{ steps.processResults.outputs.hasPassed }} - id: check_branch - run: | - if git ls-remote --heads origin load-test-results | grep -q "refs/heads/load-test-results"; then - echo "branch_exists=true" >> $GITHUB_ENV - else - echo "branch_exists=false" >> $GITHUB_ENV - fi - - name: Delete the existing load-test-results branch - if: ${{ steps.check_branch.outputs.branch_exists }} - run: git push origin --delete load-test-results - name: Push results if: ${{ steps.processResults.outputs.hasPassed }} run: git push origin load-test-results From 77a716a52d9da5670cba3ab38840336b1ca4eaac Mon Sep 17 00:00:00 2001 From: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:24:44 +0530 Subject: [PATCH 4/4] Apply suggestions from code review --- .github/workflows/process-load-test-results-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/process-load-test-results-template.yml b/.github/workflows/process-load-test-results-template.yml index 6035071b..8442d9e8 100644 --- a/.github/workflows/process-load-test-results-template.yml +++ b/.github/workflows/process-load-test-results-template.yml @@ -60,7 +60,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} - name: Push results if: ${{ steps.processResults.outputs.hasPassed }} - run: git push origin load-test-results + run: git push origin "load-test-results" env: GITHUB_TOKEN: ${{ secrets.ballerina_bot_token }} - name: Create pull request for new summary