Skip to content

Commit

Permalink
add defender
Browse files Browse the repository at this point in the history
  • Loading branch information
james-garriss committed Sep 18, 2024
1 parent 4b21542 commit c8d7a50
Show file tree
Hide file tree
Showing 2 changed files with 313 additions and 0 deletions.
298 changes: 298 additions & 0 deletions .github/workflows/function_test_defender.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
# Run functional tests for Defender

name: Function Test Defender

# This is a reusable workflow called by the pipeline.
on:
workflow_call:
inputs:
EmailOnFailure:
description: "The email address to send if workflow fails."
required: true
type: string
secrets:
PfxBase64:
required: true
PfxPassword:
required: true
TestParams:
required: true
TestParamsDev:
required: true
NotifierUsername:
required: true
NotifierPassword:
required: true
workflow_dispatch:

permissions:
id-token: write
contents: write

jobs:
Def_Tenant1:
name: ${{ github.job }}
runs-on: windows-latest
environment: Development
permissions:
id-token: write
contents: write
concurrency:
group: Defender_Tenant1
cancel-in-progress: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
path: repo
- name: Import PFX
uses: ./repo/.github/actions/import-pfx
with:
PfxBase64: ${{ secrets.PfxBase64 }}
PfxPassword: ${{ secrets.PfxPassword }}
- name: Get Thumbprint
id: get-thumbprint
uses: ./repo/.github/actions/get-thumbprint
with:
PfxPassword: ${{ secrets.PfxPassword }}
- name: Restore ScubaGear
uses: actions/cache/restore@v4
with:
path: C:\Program Files\WindowsPowerShell\Modules\ScubaGear
key: scubagear-directory-
- name: Restore Dependencies
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules
key: powershell-directory-
- name: Restore OPA
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\.scubagear\Tools
key: opa-directory-
- name: Test
id: test-product
uses: ./repo/.github/actions/test-product
with:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Extract Email
# if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
uses: ./repo/.github/actions/extract-email
env:
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
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 ${{ github.job }} test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
# to: ${{ steps.test-product.outputs.emails }}
to: jgarriss@mitre.org
from: ScubaGear Notifier
Def_Tenant1_G5:
name: ${{ github.job }}
runs-on: windows-latest
environment: Development
permissions:
id-token: write
contents: write
needs:
- Def_Tenant1
concurrency:
group: Defender_Tenant1
cancel-in-progress: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
path: repo
- name: Import PFX
uses: ./repo/.github/actions/import-pfx
with:
PfxBase64: ${{ secrets.PfxBase64 }}
PfxPassword: ${{ secrets.PfxPassword }}
- name: Get Thumbprint
id: get-thumbprint
uses: ./repo/.github/actions/get-thumbprint
with:
PfxPassword: ${{ secrets.PfxPassword }}
- name: Restore ScubaGear
uses: actions/cache/restore@v4
with:
path: C:\Program Files\WindowsPowerShell\Modules\ScubaGear
key: scubagear-directory-
- name: Restore Dependencies
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules
key: powershell-directory-
- name: Restore OPA
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\.scubagear\Tools
key: opa-directory-
- name: Test
id: test-product
uses: ./repo/.github/actions/test-product
with:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Extract Email
# if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
uses: ./repo/.github/actions/extract-email
env:
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
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 ${{ github.job }} test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
# to: ${{ steps.test-product.outputs.emails }}
to: jgarriss@mitre.org
from: ScubaGear Notifier
Def_Tenant2_G3:
name: ${{ github.job }}
runs-on: windows-latest
environment: Development
permissions:
id-token: write
contents: write
concurrency:
group: Defender_Tenant2
cancel-in-progress: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
path: repo
- name: Import PFX
uses: ./repo/.github/actions/import-pfx
with:
PfxBase64: ${{ secrets.PfxBase64 }}
PfxPassword: ${{ secrets.PfxPassword }}
- name: Get Thumbprint
id: get-thumbprint
uses: ./repo/.github/actions/get-thumbprint
with:
PfxPassword: ${{ secrets.PfxPassword }}
- name: Restore ScubaGear
uses: actions/cache/restore@v4
with:
path: C:\Program Files\WindowsPowerShell\Modules\ScubaGear
key: scubagear-directory-
- name: Restore Dependencies
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules
key: powershell-directory-
- name: Restore OPA
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\.scubagear\Tools
key: opa-directory-
- name: Test
id: test-product
uses: ./repo/.github/actions/test-product
with:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Extract Email
# if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
uses: ./repo/.github/actions/extract-email
env:
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
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 ${{ github.job }} test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
# to: ${{ steps.test-product.outputs.emails }}
to: jgarriss@mitre.org
from: ScubaGear Notifier
Def_Tenant6_G5:
name: ${{ github.job }}
runs-on: windows-latest
environment: Development
permissions:
id-token: write
contents: write
concurrency:
group: Defender_Tenant6
cancel-in-progress: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
path: repo
- name: Import PFX
uses: ./repo/.github/actions/import-pfx
with:
PfxBase64: ${{ secrets.PfxBase64 }}
PfxPassword: ${{ secrets.PfxPassword }}
- name: Get Thumbprint
id: get-thumbprint
uses: ./repo/.github/actions/get-thumbprint
with:
PfxPassword: ${{ secrets.PfxPassword }}
- name: Restore ScubaGear
uses: actions/cache/restore@v4
with:
path: C:\Program Files\WindowsPowerShell\Modules\ScubaGear
key: scubagear-directory-
- name: Restore Dependencies
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\Documents\WindowsPowerShell\Modules
key: powershell-directory-
- name: Restore OPA
uses: actions/cache/restore@v4
with:
path: C:\Users\runneradmin\.scubagear\Tools
key: opa-directory-
- name: Test
id: test-product
uses: ./repo/.github/actions/test-product
with:
Thumbprint: ${{ steps.get-thumbprint.outputs.thumbprint }}
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Extract Email
# if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
uses: ./repo/.github/actions/extract-email
env:
Alias: ${{ github.job }}
TestParams: ${{ secrets.TestParamsDev }}
- name: Notify on Failure
if: ${{ failure() && (inputs.EmailOnFailure || github.event.schedule || github.event_name == 'push') }}
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 ${{ github.job }} test failed. Please look at the "Nightly Product Functional Tests" workflow for more details.
# to: ${{ steps.test-product.outputs.emails }}
to: jgarriss@mitre.org
from: ScubaGear Notifier

Check failure on line 298 in .github/workflows/function_test_defender.yaml

View workflow job for this annotation

GitHub Actions / Lint / MegaLint YAML Check

298:35 [new-line-at-end-of-file] no new line character at the end of file
15 changes: 15 additions & 0 deletions .github/workflows/test_concurrency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ jobs:
SubscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
KeyVaultInfo: ${{ secrets.SCUBA_KEY_VAULT_PROD}}

test_defender:
name: Test Defender
uses: ./.github/workflows/function_test_defender.yaml
with:
EmailOnFailure: ${{ inputs.EmailOnFailure }}
secrets:
PfxBase64: ${{ secrets.NIGHTLY_TEST_BUILD_PFX }}
PfxPassword: ${{ secrets.NIGHTLY_TEST_BUILD_PW }}
TestParams: ${{ secrets.NIGHTLY_TEST_BUILD_PARAMS }}
TestParamsDev: ${{ secrets.NIGHTLY_TEST_BUILD_PARAMS_DEV }}
NotifierUsername: ${{ secrets.NOTIFIER_EMAIL_USERNAME }}
NotifierPassword: ${{ secrets.NOTIFIER_EMAIL_PASSWORD }}
needs:
- publish

test_exchange:
name: Test Exchange
uses: ./.github/workflows/function_test_exchange.yaml
Expand Down

0 comments on commit c8d7a50

Please sign in to comment.