Restore pipeline output variable for Agent OS name (#1709)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
parent
0dfe2f498d
commit
7e22da08b9
@ -13,4 +13,4 @@ steps:
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)
|
||||
filePath: ${{ parameters.ScriptDirectory }}/Verify-AgentOS.ps1
|
||||
arguments: >
|
||||
-AgentImage ${{ parameters.AgentImage }}
|
||||
-AgentImage "${{ parameters.AgentImage }}"
|
||||
|
||||
@ -8,6 +8,14 @@ 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 }
|
||||
if ($IsWindows -and $AgentImage -match "windows|win|MMS2019") {
|
||||
$osName = "Windows"
|
||||
} elseif ($IsLinux -and $AgentImage -match "ubuntu") {
|
||||
$osName = "Linux"
|
||||
} elseif ($IsMacOs -and $AgentImage -match "macos") {
|
||||
$osName = "macOS"
|
||||
} else {
|
||||
Throw-InvalidOperatingSystem
|
||||
}
|
||||
|
||||
Write-Host "##vso[task.setvariable variable=OSName]$osName"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user