Skip to content

Commit

Permalink
Implemented live test email notification (Azure#21565)
Browse files Browse the repository at this point in the history
  • Loading branch information
vidai-msft authored Apr 18, 2023
1 parent 5071fde commit 4018513
Show file tree
Hide file tree
Showing 9 changed files with 483 additions and 150 deletions.
250 changes: 134 additions & 116 deletions .azure-pipelines/live-test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
parameters:
- name: img_windows_2019
- name: os_windows_2019
displayName: Windows 2019 Image Version
type: string
default: windows-2019
- name: img_windows_2022
- name: os_windows_2022
displayName: Windows 2022 Image Version
type: string
default: windows-2022
- name: img_linux
- name: os_linux
displayName: Linux Image Version
type: string
default: ubuntu-20.04
- name: img_macos
- name: os_macos
displayName: MacOS Image Version
type: string
default: macOS-11
Expand Down Expand Up @@ -55,115 +55,133 @@ schedules:
pr: none
trigger: none

jobs:
- template: util/live-test-steps.yml
parameters:
name: 'win_ps_5_1_win_2019'
vmImage: ${{ parameters.img_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.win_ps_5_1 }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'win_ps_5_1_win_2022'
vmImage: ${{ parameters.img_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.win_ps_5_1 }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_win_2019'
vmImage: ${{ parameters.img_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_win_2019'
vmImage: ${{ parameters.img_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_win_2019'
vmImage: ${{ parameters.img_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_win_2022'
vmImage: ${{ parameters.img_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_win_2022'
vmImage: ${{ parameters.img_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_win_2022'
vmImage: ${{ parameters.img_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_linux'
vmImage: ${{ parameters.img_linux }}
osType: 'Linux'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_linux'
vmImage: ${{ parameters.img_linux }}
osType: 'Linux'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_linux'
vmImage: ${{ parameters.img_linux }}
osType: 'Linux'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_macOS'
vmImage: ${{ parameters.img_macos }}
osType: 'MacOS'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_macOS'
vmImage: ${{ parameters.img_macos }}
osType: 'MacOS'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_macOS'
vmImage: ${{ parameters.img_macos }}
osType: 'MacOS'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}
stages:
- stage: Test
displayName: Run Live Test
jobs:
- template: util/live-test-steps.yml
parameters:
name: 'win_ps_5_1_win_2019'
vmImage: ${{ parameters.os_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.win_ps_5_1 }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'win_ps_5_1_win_2022'
vmImage: ${{ parameters.os_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.win_ps_5_1 }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_win_2019'
vmImage: ${{ parameters.os_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_win_2019'
vmImage: ${{ parameters.os_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_win_2019'
vmImage: ${{ parameters.os_windows_2019 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_win_2022'
vmImage: ${{ parameters.os_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_win_2022'
vmImage: ${{ parameters.os_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_win_2022'
vmImage: ${{ parameters.os_windows_2022 }}
osType: 'Windows'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_linux'
vmImage: ${{ parameters.os_linux }}
osType: 'Linux'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_linux'
vmImage: ${{ parameters.os_linux }}
osType: 'Linux'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_linux'
vmImage: ${{ parameters.os_linux }}
osType: 'Linux'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_2_x_macOS'
vmImage: ${{ parameters.os_macos }}
osType: 'MacOS'
psVersion: ${{ parameters.ps_7_2_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_6 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_7_3_x_macOS'
vmImage: ${{ parameters.os_macos }}
osType: 'MacOS'
psVersion: ${{ parameters.ps_7_3_x }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- template: util/live-test-steps.yml
parameters:
name: 'ps_latest_macOS'
vmImage: ${{ parameters.os_macos }}
osType: 'MacOS'
psVersion: ${{ parameters.ps_latest }}
dotnetVersion: ${{ parameters.dotnet_sdk_7 }}

- stage: Report
displayName: Send Report
dependsOn: Test
jobs:
- job:
displayName: Send Live Test Status Report
steps:
- task: PowerShell@2
displayName: Send live test report
inputs:
pwsh: true
targetType: filePath
filePath: ./tools/TestFx/Live/SendLiveTestReport.ps1
arguments: $(KustoServicePrincipalTenantId) $(KustoServicePrincipalId) $(KustoServicePrincipalSecret) $(KustoClusterName) $(KustoClusterRegion) $(LiveTestDatabaseName) $(LiveTestTableName) $(Build.BuildId) "$(EmailServiceConnectionString)" "$(EmailFrom)" "$(EmailTo)"
3 changes: 2 additions & 1 deletion .azure-pipelines/util/live-test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ jobs:
targetType: filePath
filePath: ./tools/TestFx/Live/InvokeLiveTestCITask.ps1
arguments: -UseWindowsPowerShell ('${{ parameters.psVersion }}' -eq '5.1') -ScriptFile './tools/TestFx/Live/InvokeLiveTestScenarios.ps1 -RunPlatform ${{ parameters.osType }} -RunPowerShell ${{ parameters.psVersion }} -PowerShellLatest $(PowerShellLatest) -RepoLocation $(Build.SourcesDirectory) -DataLocation $(DataLocation)'
retryCountOnTaskFailure: 3

- task: PowerShell@2
displayName: Save live test results to Kusto
Expand All @@ -135,6 +136,6 @@ jobs:
- task: PublishPipelineArtifact@1
displayName: Publish live test results to pipeline artifact
inputs:
artifact: livetest-os-${{ parameters.vmImage }}-powershell-${{ parameters.name }}
artifact: livetest-os-${{ parameters.vmImage }}-ps-${{ replace(parameters.psVersion, '*', 'x') }}
targetPath: $(DataLocation)
condition: always()
12 changes: 2 additions & 10 deletions tools/TestFx/Live/SaveLiveTestResult.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,8 @@ if (![string]::IsNullOrWhiteSpace($liveTestResults)) {
Export-Csv -Path $_ -Encoding utf8 -NoTypeInformation -Force
}

Import-Module "./tools/TestFx/Utilities/KustoUtility.psd1" -Force
Import-KustoDataFromCsv `
-ServicePrincipalTenantId $ServicePrincipalTenantId `
-ServicePrincipalId $ServicePrincipalId `
-ServicePrincipalSecret $ServicePrincipalSecret `
-ClusterName $ClusterName `
-ClusterRegion $ClusterRegion `
-DatabaseName $DatabaseName `
-TableName $TableName `
-CsvFile $liveTestResults
Import-Module "./tools/TestFx/Utilities/KustoUtility.psd1" -ArgumentList $ServicePrincipalTenantId, $ServicePrincipalId, $ServicePrincipalSecret, $ClusterName, $ClusterRegion -Force
Import-KustoDataFromCsv -DatabaseName $DatabaseName -TableName $TableName -CsvFile $liveTestResults
}
else {
Write-Host "##[warning]No live test data was found."
Expand Down
Loading

0 comments on commit 4018513

Please sign in to comment.