diff --git a/.github/workflows/purge-aws-test-resources.yaml b/.github/workflows/purge-aws-test-resources.yaml index 8ebc612d25..dd97d82170 100644 --- a/.github/workflows/purge-aws-test-resources.yaml +++ b/.github/workflows/purge-aws-test-resources.yaml @@ -4,7 +4,7 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software @@ -23,8 +23,8 @@ on: env: AWS_REGION: us-west-2 - AWS_RESOURCE_TYPES: 'AWS::RDS::DBSubnetGroup,AWS::RDS::DBInstance,AWS::S3::Bucket,AWS::Logs::MetricFilter,AWS::Logs::LogGroup' - + AWS_RESOURCE_TYPES: "AWS::RDS::DBSubnetGroup,AWS::RDS::DBInstance,AWS::S3::Bucket,AWS::Logs::MetricFilter,AWS::Logs::LogGroup" + jobs: purge_aws_resources: name: Delete old AWS resources created by tests @@ -40,3 +40,15 @@ jobs: - name: Delete old AWS resources run: | ./.github/scripts/delete-aws-resources.sh ${{ env.AWS_RESOURCE_TYPES }} + - name: Create issue for failing purge aws test resources run + uses: actions/github-script@v7 + if: failure() + with: + github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} + script: | + github.rest.issues.create({ + ...context.repo, + title: `Purge aws test resources failed - Run ID: ${context.runId}`, + labels: ['bug', 'test-failure'], + body: `## Bug information \n\nThis bug is generated automatically if the purge aws test resources workflow fails. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` + }) diff --git a/.github/workflows/purge-test-resources.yaml b/.github/workflows/purge-test-resources.yaml index 4313cb0df4..54802260c0 100644 --- a/.github/workflows/purge-test-resources.yaml +++ b/.github/workflows/purge-test-resources.yaml @@ -4,7 +4,7 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software @@ -18,7 +18,7 @@ name: Purge test resources permissions: id-token: write # Required for requesting the JWT - contents: read # Required for actions/checkout + contents: read # Required for actions/checkout on: schedule: @@ -26,7 +26,7 @@ on: - cron: "30 0,12 * * *" env: - AZURE_RG_DELETE_LIST_FILE: 'az_rg_list.txt' + AZURE_RG_DELETE_LIST_FILE: "az_rg_list.txt" # The valid resource time window in seconds to delete the test resources. 6 hours VALID_RESOURCE_WINDOW: 6*60*60 jobs: @@ -93,5 +93,17 @@ jobs: cat ${{ env.AZURE_RG_DELETE_LIST_FILE}} | while read line do echo " * $line" >> $GITHUB_STEP_SUMMARY - az group delete --resource-group $line --yes --verbose + az group delete --resource-group $line --yes --verbose --no-wait done + - name: Create issue for failing purge test resources run + uses: actions/github-script@v7 + if: failure() + with: + github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }} + script: | + github.rest.issues.create({ + ...context.repo, + title: `Purge test resources failed - Run ID: ${context.runId}`, + labels: ['bug', 'test-failure'], + body: `## Bug information \n\nThis bug is generated automatically if the purge test resources workflow fails. For the further investigation, please visit [here](${process.env.ACTION_LINK}).` + })