Open mikeharder opened 1 year ago
We can also use $IsWindows
, $IsLinux
, etc. in PowerShell but I want to make sure that we get the "marketing" version of the platform, e.g. Windows Server 2022 vs. Windows_NT
We were using the OS vm image as a way to discover that information without having to query the OS and then work backwards toward a version. It might make sense to parse $PSVersionTable.OS
but we'll have to see how that works in the various OS' we use. It hasn't been investigated yet.
@danieljurek: Are you saying we have cases where we want to know the OS version (e.g. Windows 2019 vs Windows 2022), rather than just Windows vs Linux vs Mac? In that case, I agree OSVmImage
might be preferable to Agent.OS
.
But I also know we have code that maps OSVmImage
to one of the three operating systems, and I think that code could be replaced by Agent.OS
.
Correct, we try to put the OS marketing version in the output: https://github.com/Azure/azure-sdk-for-cpp/blob/main/eng/scripts/Get-BinarySizes.ps1#L56
I believe many of our scripts and YML use custom variables like
OSVmImage
to detect operating system. However, I think it might be better to use the built-in variableAgent.OS
instead.https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#agent-variables-devops-services