From 65b6cd81ad594d5c8a704b86e0665a81dfa48efb Mon Sep 17 00:00:00 2001 From: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:39:55 -0800 Subject: [PATCH] Update scheduled test run notification logic. With this update every scheduled functional/long running test run failure will log a new issue. Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> --- .github/workflows/functional-test-cloud.yaml | 31 ++----------------- .../workflows/functional-test-noncloud.yaml | 30 +----------------- .github/workflows/long-running-azure.yaml | 29 +---------------- 3 files changed, 4 insertions(+), 86 deletions(-) diff --git a/.github/workflows/functional-test-cloud.yaml b/.github/workflows/functional-test-cloud.yaml index 2042fa807b..bc58f8b2aa 100644 --- a/.github/workflows/functional-test-cloud.yaml +++ b/.github/workflows/functional-test-cloud.yaml @@ -85,8 +85,6 @@ env: FUNCTIONAL_TEST_APP_ID: 425843 # Private Git repository where terraform module for testing is stored. TF_RECIPE_PRIVATE_GIT_SOURCE: "git::https://github.com/radius-project/terraform-private-modules//kubernetes-redis" - # The number of failed tests to report. - ISSUE_CREATE_THRESHOLD: 2 # bicep-types ACR url for uploading Radius Bicep types BICEP_TYPES_REGISTRY: 'biceptypes.azurecr.io' @@ -894,33 +892,8 @@ jobs: runs-on: ubuntu-latest if: failure() && github.event_name == 'schedule' && github.repository == 'radius-project/radius' steps: - - name: Count recently failed tests - id: count_failures - uses: actions/github-script@v7 - with: - script: | - response = await github.rest.actions.listWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'functional-test-cloud.yaml', - event: 'schedule', - per_page: 10 - }); - - failureCount = 1; - for (const run of response.data.workflow_runs) { - if (run.conclusion === 'failure') { - failureCount++; - } else { - break; - } - } - return failureCount; - - name: Create failure issue for failing scheduled run uses: actions/github-script@v7 - # Only create an issue if there are (env.ISSUE_CREATE_THRESHOLD) failures of the recent tests. - if: steps.count_failures.outputs.result >= env.ISSUE_CREATE_THRESHOLD with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} script: | @@ -928,5 +901,5 @@ jobs: ...context.repo, title: `Scheduled functional test failed - Run ID: ${context.runId}`, labels: ['bug', 'test-failure'], - body: `## Bug information \n\nThis bug is generated automatically if the scheduled functional test fails at least ${process.env.ISSUE_CREATE_THRESHOLD} times in a row. The Radius functional test operates on a schedule of every 4 hours during weekdays and every 12 hours over the weekend. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` - }) \ No newline at end of file + body: `## Bug information \n\nThis issue is automatically generated if the scheduled functional test fails. The Radius functional test operates on a schedule of every 4 hours during weekdays and every 12 hours over the weekend. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` + }) diff --git a/.github/workflows/functional-test-noncloud.yaml b/.github/workflows/functional-test-noncloud.yaml index 7560b7aa38..870dde5d84 100644 --- a/.github/workflows/functional-test-noncloud.yaml +++ b/.github/workflows/functional-test-noncloud.yaml @@ -66,10 +66,6 @@ env: TF_RECIPE_MODULE_SERVER_URL: "http://tf-module-server.radius-test-tf-module-server.svc.cluster.local" # Private Git repository where terraform module for testing is stored. TF_RECIPE_PRIVATE_GIT_SOURCE: "git::https://github.com/radius-project/terraform-private-modules//kubernetes-redis" - - # The number of failed tests to report. - ISSUE_CREATE_THRESHOLD: 2 - # Local Docker registry name LOCAL_REGISTRY_NAME: "radius-registry" # Local Docker registry server @@ -453,32 +449,8 @@ jobs: runs-on: ubuntu-latest if: failure() && github.event_name == 'schedule' && github.repository == 'radius-project/radius' steps: - - name: Count recently failed tests - id: count_failures - uses: actions/github-script@v7 - with: - script: | - response = await github.rest.actions.listWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'functional-test-noncloud.yaml', - event: 'schedule', - per_page: 10 - }); - - failureCount = 1; - for (const run of response.data.workflow_runs) { - if (run.conclusion === 'failure') { - failureCount++; - } else { - break; - } - } - return failureCount; - name: Create failure issue for failing scheduled run uses: actions/github-script@v7 - # Only create an issue if there are (env.ISSUE_CREATE_THRESHOLD) failures of the recent tests. - if: steps.count_failures.outputs.result >= env.ISSUE_CREATE_THRESHOLD with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} script: | @@ -486,5 +458,5 @@ jobs: ...context.repo, title: `Scheduled functional test (noncloud) failed - Run ID: ${context.runId}`, labels: ['bug', 'test-failure'], - body: `## Bug information \n\nThis bug is generated automatically if the scheduled functional test fails at least ${process.env.ISSUE_CREATE_THRESHOLD} times in a row. The Radius functional test operates on a schedule of every 4 hours during weekdays and every 12 hours over the weekend. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` + body: `## Bug information \n\nThis issue is automatically generated if the scheduled functional test fails. The Radius functional test operates on a schedule of every 4 hours during weekdays and every 12 hours over the weekend. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` }) diff --git a/.github/workflows/long-running-azure.yaml b/.github/workflows/long-running-azure.yaml index ce30023e82..94f2e38cbe 100644 --- a/.github/workflows/long-running-azure.yaml +++ b/.github/workflows/long-running-azure.yaml @@ -95,9 +95,6 @@ env: # The current GitHub action link ACTION_LINK: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - # The number of failed tests to report. - ISSUE_CREATE_THRESHOLD: 2 - jobs: build: name: Build Radius for test @@ -522,32 +519,8 @@ jobs: runs-on: ubuntu-latest if: failure() && github.repository == 'radius-project/radius' && github.event_name == 'schedule' steps: - - name: Count recently failed tests - id: count_failures - uses: actions/github-script@v7 - with: - script: | - response = await github.rest.actions.listWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'long-running-azure.yaml', - event: 'schedule', - per_page: 10 - }); - - failureCount = 1; - for (const run of response.data.workflow_runs) { - if (run.conclusion === 'failure') { - failureCount++; - } else { - break; - } - } - return failureCount; - name: Create failure issue for failing long running test run uses: actions/github-script@v7 - # Only create an issue if there are (env.ISSUE_CREATE_THRESHOLD) failures of the recent tests. - if: steps.count_failures.outputs.result >= env.ISSUE_CREATE_THRESHOLD with: github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} script: | @@ -555,5 +528,5 @@ jobs: ...context.repo, title: `Scheduled long running test failed - Run ID: ${context.runId}`, labels: ['bug', 'test-failure'], - body: `## Bug information \n\nThis bug is generated automatically if the scheduled long running test fails at least ${process.env.ISSUE_CREATE_THRESHOLD} times in a row. The Radius long running test operates on a schedule of every 2 hours everyday. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` + body: `## Bug information \n\nThis issue is automatically generated if the scheduled long running test fails. The Radius long running test operates on a schedule of every 2 hours everyday. It's important to understand that the test may fail due to workflow infrastructure issues, like network problems, rather than the flakiness of the test itself. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` })