Files
Assistant/deploy/windows/Invoke-DomovoyProductionMonitoring.ps1
m 5a07a13ac8
CI / test (push) Successful in 11s
CI / test (pull_request) Successful in 10s
ops: notify on production health transitions
2026-08-16 18:29:26 +03:00

21 lines
890 B
PowerShell

[CmdletBinding()]
param(
[string]$HealthScriptPath = (Join-Path $PSScriptRoot 'Test-DomovoyProductionHealth.ps1'),
[string]$NotificationScriptPath = (Join-Path $PSScriptRoot 'Send-DomovoyHealthNotification.ps1')
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
if (-not (Test-Path -LiteralPath $HealthScriptPath -PathType Leaf)) { throw 'Health monitoring script not found' }
if (-not (Test-Path -LiteralPath $NotificationScriptPath -PathType Leaf)) { throw 'Health notification script not found' }
$pwsh = (Get-Command pwsh.exe -ErrorAction Stop).Source
& $pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File $HealthScriptPath
$healthExitCode = $LASTEXITCODE
& $pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File $NotificationScriptPath
$notificationExitCode = $LASTEXITCODE
if ($notificationExitCode -ne 0) { exit 2 }
exit $healthExitCode