mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2026-01-06 18:17:26 +08:00
Add Windows Server 2022 image templates (#3929)
* add windows2022 image template Co-authored-by: Aleksandr Chebotov <v-aleche@microsoft.com> Co-authored-by: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Co-authored-by: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,7 @@ Export-ModuleMember -Function @(
|
||||
'Install-VsixExtension'
|
||||
'Get-VSExtensionVersion'
|
||||
'Get-WinVersion'
|
||||
'Test-IsWin22'
|
||||
'Test-IsWin19'
|
||||
'Test-IsWin16'
|
||||
'Choco-Install'
|
||||
|
||||
@@ -380,6 +380,11 @@ function Get-WinVersion
|
||||
(Get-CimInstance -ClassName Win32_OperatingSystem).Caption
|
||||
}
|
||||
|
||||
function Test-IsWin22
|
||||
{
|
||||
(Get-WinVersion) -match "2022"
|
||||
}
|
||||
|
||||
function Test-IsWin19
|
||||
{
|
||||
(Get-WinVersion) -match "2019"
|
||||
|
||||
@@ -15,8 +15,8 @@ C:\msys64\usr\bin\bash.exe -leo pipefail %*
|
||||
# gitbash <--> C:\Program Files\Git\bin\bash.exe
|
||||
New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null
|
||||
|
||||
# WSL is available on Windows Server 2019
|
||||
if (Test-IsWin19)
|
||||
# WSL is available on Windows Server 2019 and Windows Server 2022
|
||||
if (-not (Test-IsWin16))
|
||||
{
|
||||
# wslbash <--> C:\Windows\System32\bash.exe
|
||||
New-Item -ItemType SymbolicLink -Path "$shellPath\wslbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null
|
||||
|
||||
@@ -12,6 +12,32 @@ Set-SystemVariable -SystemVariable DOTNET_MULTILEVEL_LOOKUP -Value "0"
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
||||
|
||||
function Get-SDKVersionsToInstall (
|
||||
$DotnetVersion
|
||||
) {
|
||||
$releaseJson = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${DotnetVersion}/releases.json"
|
||||
$releasesJsonPath = Start-DownloadWithRetry -Url $releaseJson -Name "releases-${DotnetVersion}.json"
|
||||
$currentReleases = Get-Content -Path $releasesJsonPath | ConvertFrom-Json
|
||||
# filtering out the preview/rc releases
|
||||
$currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') }
|
||||
|
||||
$sdks = @()
|
||||
ForEach ($release in $currentReleases)
|
||||
{
|
||||
$sdks += $release.'sdk'
|
||||
$sdks += $release.'sdks'
|
||||
}
|
||||
|
||||
$sortedSdkVersions = $sdks.version | Sort-Object { [Version] $_ } -Unique
|
||||
|
||||
if (Test-IsWin22)
|
||||
{
|
||||
return $sortedSdkVersions | Group-Object { $_.Substring(0, $_.LastIndexOf('.') + 2) } | Foreach-Object { $_.Group[-1] }
|
||||
}
|
||||
|
||||
return $sortedSdkVersions
|
||||
}
|
||||
|
||||
function Invoke-Warmup (
|
||||
$SdkVersion
|
||||
) {
|
||||
@@ -78,35 +104,11 @@ function InstallAllValidSdks()
|
||||
|
||||
ForEach ($dotnetVersion in $dotnetVersions)
|
||||
{
|
||||
$releaseJson = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${dotnetVersion}/releases.json"
|
||||
$releasesJsonPath = Start-DownloadWithRetry -Url $releaseJson -Name "releases-${dotnetVersion}.json"
|
||||
$currentReleases = Get-Content -Path $releasesJsonPath | ConvertFrom-Json
|
||||
# filtering out the preview/rc releases
|
||||
$currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' }
|
||||
|
||||
ForEach ($release in $currentReleases)
|
||||
$sdkVersionsToInstall = Get-SDKVersionsToInstall -DotnetVersion $dotnetVersion
|
||||
|
||||
ForEach ($sdkVersion in $sdkVersionsToInstall)
|
||||
{
|
||||
if ($release.'sdks'.Count -gt 0)
|
||||
{
|
||||
Write-Host 'Found sdks property in release: ' + $release.'release-version' + 'with sdks count: ' + $release.'sdks'.Count
|
||||
|
||||
# Remove duplicate entries & preview/rc version from download list
|
||||
# Sort the sdks on version
|
||||
$sdks = @($release.'sdk');
|
||||
|
||||
$sdks += $release.'sdks' | Where-Object { !$_.'version'.Contains('-') -and !$_.'version'.Equals($release.'sdk'.'version') }
|
||||
$sdks = $sdks | Sort-Object { [Version] $_.'version' }
|
||||
|
||||
ForEach ($sdk in $sdks)
|
||||
{
|
||||
InstallSDKVersion -sdkVersion $sdk.'version' -Warmup $warmup
|
||||
}
|
||||
}
|
||||
elseif (!$release.'sdk'.'version'.Contains('-'))
|
||||
{
|
||||
$sdkVersion = $release.'sdk'.'version'
|
||||
InstallSDKVersion -SdkVersion $sdkVersion -Warmup $warmup
|
||||
}
|
||||
InstallSDKVersion -SdkVersion $sdkVersion -Warmup $warmup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ $imageVersion = $env:IMAGE_VERSION
|
||||
$imageDataFile = $env:IMAGEDATA_FILE
|
||||
$githubUrl="https://github.com/actions/virtual-environments/blob"
|
||||
|
||||
if (Test-IsWin19) {
|
||||
if (Test-IsWin22) {
|
||||
$imageLabel = "windows-2022"
|
||||
$softwareUrl = "${githubUrl}/win22/${imageVersion}/images/win/Windows2022-Readme.md"
|
||||
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win22%2F${imageVersion}"
|
||||
} elseif (Test-IsWin19) {
|
||||
$imageLabel = "windows-2019"
|
||||
$softwareUrl = "${githubUrl}/win19/${imageVersion}/images/win/Windows2019-Readme.md"
|
||||
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win19%2F${imageVersion}"
|
||||
|
||||
@@ -9,7 +9,7 @@ function Get-OSVersion {
|
||||
}
|
||||
|
||||
function Get-BashVersion {
|
||||
$version = bash -c 'echo ${BASH_VERSION}'
|
||||
$version = bash --% -c 'echo ${BASH_VERSION}'
|
||||
return "Bash $version"
|
||||
}
|
||||
|
||||
@@ -276,6 +276,10 @@ function Get-CachedDockerImages {
|
||||
|
||||
function Get-CachedDockerImagesTableData {
|
||||
$allImages = docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}"
|
||||
if (-not $allImages) {
|
||||
return $null
|
||||
}
|
||||
|
||||
$allImages.Split("*") | Where-Object { $_ } | ForEach-Object {
|
||||
$parts = $_.Split("|")
|
||||
[PSCustomObject] @{
|
||||
@@ -321,16 +325,21 @@ function Get-PipxVersion {
|
||||
}
|
||||
|
||||
function Build-PackageManagementEnvironmentTable {
|
||||
return @(
|
||||
@{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
},
|
||||
$envVariables = @(
|
||||
@{
|
||||
"Name" = "VCPKG_INSTALLATION_ROOT"
|
||||
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
||||
}
|
||||
) | ForEach-Object {
|
||||
)
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$envVariables += @(
|
||||
@{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
}
|
||||
)
|
||||
}
|
||||
return $envVariables | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = $_.Value
|
||||
|
||||
@@ -31,25 +31,27 @@ if (Test-IsWin19)
|
||||
|
||||
$markdown += New-MDHeader "Installed Software" -Level 2
|
||||
$markdown += New-MDHeader "Language and Runtime" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
$languageTools = @(
|
||||
(Get-BashVersion),
|
||||
(Get-GoVersion),
|
||||
(Get-JuliaVersion),
|
||||
(Get-NodeVersion),
|
||||
(Get-PerlVersion),
|
||||
(Get-PHPVersion),
|
||||
(Get-PythonVersion),
|
||||
(Get-RubyVersion),
|
||||
(Get-KotlinVersion)
|
||||
) | Sort-Object
|
||||
)
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$languageTools += @(
|
||||
(Get-PerlVersion)
|
||||
)
|
||||
}
|
||||
$markdown += New-MDList -Style Unordered -Lines ($languageTools | Sort-Object)
|
||||
|
||||
$markdown += New-MDHeader "Package Management" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
$packageManagementList = @(
|
||||
(Get-ChocoVersion),
|
||||
(Get-ComposerVersion),
|
||||
(Get-HelmVersion),
|
||||
(Get-CondaVersion),
|
||||
(Get-NPMVersion),
|
||||
(Get-NugetVersion),
|
||||
(Get-PipxVersion),
|
||||
@@ -57,23 +59,36 @@ $markdown += New-MDList -Style Unordered -Lines (@(
|
||||
(Get-RubyGemsVersion),
|
||||
(Get-VcpkgVersion),
|
||||
(Get-YarnVersion)
|
||||
) | Sort-Object
|
||||
)
|
||||
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$packageManagementList += @(
|
||||
(Get-CondaVersion)
|
||||
)
|
||||
}
|
||||
|
||||
$markdown += New-MDHeader "Package Management" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines ($packageManagementList | Sort-Object)
|
||||
|
||||
$markdown += New-MDHeader "Environment variables" -Level 4
|
||||
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
$markdown += New-MDHeader "Project Management" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
$projectManagementTools = @(
|
||||
(Get-AntVersion),
|
||||
(Get-GradleVersion),
|
||||
(Get-MavenVersion),
|
||||
(Get-SbtVersion)
|
||||
) | Sort-Object
|
||||
(Get-MavenVersion)
|
||||
)
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$projectManagementTools += @(
|
||||
(Get-SbtVersion)
|
||||
)
|
||||
}
|
||||
$markdown += New-MDList -Style Unordered -Lines ($projectManagementTools | Sort-Object)
|
||||
|
||||
$markdown += New-MDHeader "Tools" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
$toolsList = @(
|
||||
(Get-7zipVersion),
|
||||
(Get-Aria2Version),
|
||||
(Get-AzCopyVersion),
|
||||
@@ -89,7 +104,6 @@ $markdown += New-MDList -Style Unordered -Lines (@(
|
||||
(Get-GitVersion),
|
||||
(Get-GitLFSVersion),
|
||||
(Get-GVFSVersion),
|
||||
(Get-GoogleCloudSDKVersion),
|
||||
(Get-InnoSetupVersion),
|
||||
(Get-JQVersion),
|
||||
(Get-KindVersion),
|
||||
@@ -97,7 +111,6 @@ $markdown += New-MDList -Style Unordered -Lines (@(
|
||||
(Get-MercurialVersion),
|
||||
(Get-MinGWVersion),
|
||||
(Get-NewmanVersion),
|
||||
(Get-NSISVersion),
|
||||
(Get-OpenSSLVersion),
|
||||
(Get-PackerVersion),
|
||||
(Get-PulumiVersion),
|
||||
@@ -109,22 +122,32 @@ $markdown += New-MDList -Style Unordered -Lines (@(
|
||||
(Get-WinAppDriver),
|
||||
(Get-ZstdVersion),
|
||||
(Get-YAMLLintVersion)
|
||||
) | Sort-Object
|
||||
)
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$toolsList += @(
|
||||
(Get-NSISVersion),
|
||||
(Get-GoogleCloudSDKVersion)
|
||||
)
|
||||
}
|
||||
$markdown += New-MDList -Style Unordered -Lines ($toolsList | Sort-Object)
|
||||
|
||||
$markdown += New-MDHeader "CLI Tools" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
$cliTools = @(
|
||||
(Get-AlibabaCLIVersion),
|
||||
(Get-AWSCLIVersion),
|
||||
(Get-AWSSAMVersion),
|
||||
(Get-AWSSessionManagerVersion),
|
||||
(Get-AzureCLIVersion),
|
||||
(Get-AzureDevopsExtVersion),
|
||||
(Get-CloudFoundryVersion),
|
||||
(Get-GHVersion),
|
||||
(Get-HubVersion)
|
||||
) | Sort-Object
|
||||
)
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$cliTools += @(
|
||||
(Get-CloudFoundryVersion)
|
||||
)
|
||||
}
|
||||
$markdown += New-MDList -Style Unordered -Lines ($cliTools | Sort-Object)
|
||||
|
||||
$markdown += New-MDHeader "Rust Tools" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Desc: Test BizTalk project build component installed.
|
||||
################################################################################
|
||||
|
||||
Describe "BizTalk Build Component Setup" -Skip:(Test-IsWin16) {
|
||||
Describe "BizTalk Build Component Setup" -Skip:(-not (Test-IsWin19)) {
|
||||
It "BizTalk Registry Check" {
|
||||
Test-Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\BizTalk Server\3.0" | Should -BeTrue
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ Describe "GitHub CLI" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "CloudFoundry CLI" {
|
||||
Describe "CloudFoundry CLI" -Skip:(Test-IsWin22) {
|
||||
It "cf is located in C:\cf-cli" {
|
||||
"C:\cf-cli\cf.exe" | Should -Exist
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ Describe "Bicep" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "GitVersion" {
|
||||
Describe "GitVersion" -Skip:(Test-IsWin22) {
|
||||
It "gitversion is installed" {
|
||||
"gitversion /version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "InnoSetup" {
|
||||
Describe "InnoSetup" -Skip:(Test-IsWin22) {
|
||||
It "InnoSetup" {
|
||||
(Get-Command -Name iscc).CommandType | Should -BeExactly "Application"
|
||||
}
|
||||
@@ -58,7 +58,7 @@ Describe "Packer" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Perl" {
|
||||
Describe "Perl" -Skip:(Test-IsWin22) {
|
||||
It "Perl" {
|
||||
"perl --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
@@ -14,10 +14,15 @@ Describe "MSYS2 packages" {
|
||||
|
||||
$TestCases = @(
|
||||
@{ ToolName = "bash.exe" }
|
||||
@{ ToolName = "tar.exe" }
|
||||
@{ ToolName = "make.exe" }
|
||||
)
|
||||
|
||||
if ((Test-IsWin16) -or (Test-IsWin19)) {
|
||||
$TestCases += @(
|
||||
@{ ToolName = "tar.exe" }
|
||||
@{ ToolName = "make.exe" }
|
||||
)
|
||||
}
|
||||
|
||||
It "<ToolName> is installed in <msys2Dir>" -TestCases $TestCases {
|
||||
(Get-Command "$ToolName").Source | Should -BeLike "$msys2Dir*"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Miniconda" {
|
||||
Describe "Miniconda" -Skip:(Test-IsWin22) {
|
||||
It "Miniconda Environment variables is set. " {
|
||||
${env:CONDA} | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ Describe "AzureModules" {
|
||||
if ($module.default) {
|
||||
$moduleInfo = @{ moduleName = $moduleName; moduleDefault = $module.default }
|
||||
It "<moduleDefault> set as default" -TestCases $moduleInfo {
|
||||
$moduleVersion = (Get-Module -ListAvailable -Name $moduleName).Version.ToString()
|
||||
$moduleVersion | Should -Match $moduleDefault
|
||||
$moduleVersions = Get-Module -ListAvailable -Name $moduleName | ForEach-Object { $_.Version.ToString() }
|
||||
$moduleVersions | Should -Contain $moduleDefault
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,13 +42,16 @@ Describe "DACFx" {
|
||||
It "DACFx" {
|
||||
(Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Contains "Microsoft SQL Server Data-Tier Application Framework (x64)" | Should -BeTrue
|
||||
$sqlPackagePath = 'C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe'
|
||||
$sqlLocalDBPath = 'C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe'
|
||||
"${sqlPackagePath}" | Should -Exist
|
||||
}
|
||||
|
||||
It "SqlLocalDB" -Skip:(Test-IsWin22) {
|
||||
$sqlLocalDBPath = 'C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe'
|
||||
"${sqlLocalDBPath}" | Should -Exist
|
||||
}
|
||||
}
|
||||
|
||||
Describe "DotnetTLS" {
|
||||
Describe "DotnetTLS" -Skip:(Test-IsWin22) {
|
||||
It "Tls 1.2 is enabled" {
|
||||
[Net.ServicePointManager]::SecurityProtocol -band "Tls12" | Should -Be Tls12
|
||||
}
|
||||
@@ -88,7 +91,7 @@ Describe "Mingw64" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "GoogleCloudSDK" {
|
||||
Describe "GoogleCloudSDK" -Skip:(Test-IsWin22) {
|
||||
It "<ToolName>" -TestCases @(
|
||||
@{ ToolName = "bq" }
|
||||
@{ ToolName = "gcloud" }
|
||||
@@ -105,7 +108,7 @@ Describe "NET48" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "NSIS" {
|
||||
Describe "NSIS" -Skip:(Test-IsWin22) {
|
||||
It "NSIS" {
|
||||
"makensis /VERSION" | Should -ReturnZeroExitCode
|
||||
}
|
||||
@@ -121,13 +124,13 @@ Describe "PowerShell Core" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Sbt" {
|
||||
Describe "Sbt" -Skip:(Test-IsWin22) {
|
||||
It "sbt" {
|
||||
"sbt --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "ServiceFabricSDK" {
|
||||
Describe "ServiceFabricSDK" -Skip:(Test-IsWin22) {
|
||||
It "PowerShell Module" {
|
||||
Get-Module -Name ServiceFabric -ListAvailable | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
@@ -153,7 +156,7 @@ Describe "Vcpkg" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "WebPlatformInstaller" {
|
||||
Describe "WebPlatformInstaller" -Skip:(Test-IsWin22) {
|
||||
It "WebPlatformInstaller" {
|
||||
"WebPICMD" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "WDK" {
|
||||
Describe "WDK" -Skip:(Test-IsWin22) {
|
||||
It "WDK exists" {
|
||||
$WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version
|
||||
$WDKVersion| Should -Not -BeNullOrEmpty
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Wix" {
|
||||
Describe "Wix" -Skip:(Test-IsWin22) {
|
||||
BeforeAll {
|
||||
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
$installedApplications = Get-ItemProperty -Path $regKey
|
||||
|
||||
Reference in New Issue
Block a user