Skip to content

Commit 2e8ff8c

Browse files
azure-sdkbenbp
andauthored
Restore pipeline output variable for Agent OS name (Azure#16832)
Co-authored-by: Ben Broderick Phillips <[email protected]>
1 parent 9f1a27b commit 2e8ff8c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

eng/common/pipelines/templates/steps/verify-agent-os.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ steps:
1313
workingDirectory: $(System.DefaultWorkingDirectory)
1414
filePath: ${{ parameters.ScriptDirectory }}/Verify-AgentOS.ps1
1515
arguments: >
16-
-AgentImage ${{ parameters.AgentImage }}
16+
-AgentImage "${{ parameters.AgentImage }}"

eng/common/scripts/Verify-AgentOS.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ function Throw-InvalidOperatingSystem {
88
throw "Invalid operating system detected. Operating system was: $([System.Runtime.InteropServices.RuntimeInformation]::OSDescription), expected image was: $AgentImage"
99
}
1010

11-
if ($AgentImage -match "windows|win|MMS2019" -and !$IsWindows) { Throw-InvalidOperatingSystem }
12-
if ($AgentImage -match "ubuntu" -and !$IsLinux) { Throw-InvalidOperatingSystem }
13-
if ($AgentImage -match "macos" -and !$IsMacOs) { Throw-InvalidOperatingSystem }
11+
if ($IsWindows -and $AgentImage -match "windows|win|MMS2019") {
12+
$osName = "Windows"
13+
} elseif ($IsLinux -and $AgentImage -match "ubuntu") {
14+
$osName = "Linux"
15+
} elseif ($IsMacOs -and $AgentImage -match "macos") {
16+
$osName = "macOS"
17+
} else {
18+
Throw-InvalidOperatingSystem
19+
}
20+
21+
Write-Host "##vso[task.setvariable variable=OSName]$osName"

0 commit comments

Comments
 (0)