azure-sdk-for-cpp/eng/common/scripts/Verify-AgentOS.ps1
Azure SDK Bot 74bfafcb52
Sync eng/common directory with azure-sdk-tools for PR 1371 (#1634)
* Rework verify agent OS step.

* Address feedback

* Justing string matching instead.

* ! instead of -not

Co-authored-by: Mitch Denny <midenn@microsoft.com>
2021-02-14 15:56:25 -08:00

13 lines
573 B
PowerShell

param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $AgentImage
)
function Throw-InvalidOperatingSystem {
throw "Invalid operating system detected. Operating system was: $([System.Runtime.InteropServices.RuntimeInformation]::OSDescription), expected image was: $AgentImage"
}
if ($AgentImage -match "windows|win|MMS2019" -and !$IsWindows) { Throw-InvalidOperatingSystem }
if ($AgentImage -match "ubuntu" -and !$IsLinux) { Throw-InvalidOperatingSystem }
if ($AgentImage -match "macos" -and !$IsMacOs) { Throw-InvalidOperatingSystem }