Skip to content

Commit

Permalink
Improve functional test notifications (#1401)
Browse files Browse the repository at this point in the history
* write email

* fixed runs-on

* create link

* add notify

* fix secrets

* fix to

* fix yaml

* email on fail

* both pass

* both fail

* move email to its own job

* add debugging

* enable EntraID

* enable all the rest

* checkout repo for email

* fix repo path for checkout

* fix path again

* run email on windows

* clean up commenting

* remove test file

* remove comments
  • Loading branch information
james-garriss authored Nov 13, 2024
1 parent 39b17c1 commit 5987051
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 659 deletions.
165 changes: 22 additions & 143 deletions .github/workflows/function_test_defender.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Run functional tests for Defender

name: Function Test Defender
name: Functional Tests Defender

# This is a reusable workflow called by the pipeline.
on:
Expand Down Expand Up @@ -84,28 +84,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant1
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant1
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
# Debugging
# inputs.GitHubEventName == 'push'
# inputs.GitHubEventName == 'schedule'
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant1 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant1_G5:
name: Def_Tenant1_G5
runs-on: windows-latest
Expand Down Expand Up @@ -155,25 +133,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant1_G5
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant1_G5
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant1_G5 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant2:
name: Def_Tenant2
runs-on: windows-latest
Expand Down Expand Up @@ -220,25 +179,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant2
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant2
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant2 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant2_G3:
name: Def_Tenant2_G3
runs-on: windows-latest
Expand Down Expand Up @@ -288,25 +228,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant2_G3
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant2_G3
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant2_G3 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant3:
name: Def_Tenant3
runs-on: windows-latest
Expand Down Expand Up @@ -353,25 +274,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant3
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant3
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant3 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant3_G5:
name: Def_Tenant3_G5
runs-on: windows-latest
Expand Down Expand Up @@ -421,25 +323,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant3_G5
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant3_G5
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant3_G5 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant6:
name: Def_Tenant6
runs-on: windows-latest
Expand Down Expand Up @@ -486,25 +369,6 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant6
TestParams: ${{ secrets.TestParams }}
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
env:
Alias: Def_Tenant6
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant6 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
Def_Tenant6_G5:
name: Def_Tenant6_G5
runs-on: windows-latest
Expand Down Expand Up @@ -554,22 +418,37 @@ jobs:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: Def_Tenant6_G5
TestParams: ${{ secrets.TestParams }}
email:
name: Email
runs-on: windows-latest
needs:
- Def_Tenant1
- Def_Tenant1_G5
- Def_Tenant2
- Def_Tenant2_G3
- Def_Tenant3
- Def_Tenant3_G5
- Def_Tenant6
- Def_Tenant6_G5
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Extract Email
id: extract-email
if: ${{ always() }}
uses: ./repo/.github/actions/extract-email
uses: ./.github/actions/extract-email
env:
Alias: Def_Tenant6_G5
# Could use any of previous jobs as the alias
Alias: Def_Tenant1
TestParams: ${{ secrets.TestParams }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || inputs.GitHubEventName == 'schedule') }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.NotifierUsername }}
password: ${{ secrets.NotifierPassword }}
subject: Nightly functional test failure
body: The Def_Tenant6_G5 test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
subject: ScubaGear Functional Test Failure
to: ${{ steps.extract-email.outputs.emails }}
from: ScubaGear Notifier
body: This workflow failed ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
Loading

0 comments on commit 5987051

Please sign in to comment.