mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 21:38:13 +00:00
[Windows] Move Windows features to toolset (#3838)
* move windows features to toolset * Update WindowsFeatures.Tests.ps1 * revert templates
This commit is contained in:
@@ -417,6 +417,7 @@ function Install-AndroidSDKPackages {
|
|||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$AndroidSDKRootPath,
|
[string]$AndroidSDKRootPath,
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
|
[AllowEmptyCollection()]
|
||||||
[string[]]$AndroidPackages,
|
[string[]]$AndroidPackages,
|
||||||
[string] $PrefixPackageName
|
[string] $PrefixPackageName
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,6 +29,18 @@ function Invoke-Warmup (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Fix-ImportPublishProfile (
|
||||||
|
$SdkVersion
|
||||||
|
) {
|
||||||
|
if (Test-IsWin16 -or Test-IsWin19) {
|
||||||
|
# Fix for issue https://github.com/dotnet/sdk/issues/1276. This will be fixed in 3.1.
|
||||||
|
$sdkTargetsName = "Microsoft.NET.Sdk.ImportPublishProfile.targets"
|
||||||
|
$sdkTargetsUrl = "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/${sdkTargetsName}"
|
||||||
|
$sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets"
|
||||||
|
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function InstallSDKVersion (
|
function InstallSDKVersion (
|
||||||
$SdkVersion,
|
$SdkVersion,
|
||||||
$Warmup
|
$Warmup
|
||||||
@@ -44,11 +56,7 @@ function InstallSDKVersion (
|
|||||||
Write-Host "Sdk version $sdkVersion already installed"
|
Write-Host "Sdk version $sdkVersion already installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fix for issue 1276. This will be fixed in 3.1.
|
Fix-ImportPublishProfile -SdkVersion $SdkVersion
|
||||||
$sdkTargetsName = "Microsoft.NET.Sdk.ImportPublishProfile.targets"
|
|
||||||
$sdkTargetsUrl = "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/${sdkTargetsName}"
|
|
||||||
$sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets"
|
|
||||||
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
|
|
||||||
|
|
||||||
if ($Warmup) {
|
if ($Warmup) {
|
||||||
Invoke-Warmup -SdkVersion $SdkVersion
|
Invoke-Warmup -SdkVersion $SdkVersion
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Set-SystemVariable -SystemVariable PGUSER -Value $pgUser
|
|||||||
Set-SystemVariable -SystemVariable PGPASSWORD -Value $pgPwd
|
Set-SystemVariable -SystemVariable PGPASSWORD -Value $pgPwd
|
||||||
|
|
||||||
#Install latest PostgreSQL
|
#Install latest PostgreSQL
|
||||||
Choco-Install -PackageName postgresql -ArgumentList "--params", "'/Password:$pgPwd /NoPath'", "--params-global", "--debug", "--verbose"
|
Choco-Install -PackageName postgresql -ArgumentList "--params", "'/Password:$pgPwd /NoPath'", "--params-global"
|
||||||
|
|
||||||
#Get Path to pg_ctl.exe
|
#Get Path to pg_ctl.exe
|
||||||
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
|
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
# Install .NET Framework 3.5 (required by Chocolatey)
|
$windowsFeatures = (Get-ToolsetContent).windowsFeatures
|
||||||
# Explicitly install all 4.7 sub features to include ASP.Net.
|
|
||||||
# As of 1/16/2019, WinServer 19 lists .Net 4.7 as NET-Framework-45-Features
|
|
||||||
Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature
|
|
||||||
Install-WindowsFeature -Name NET-Framework-45-Features -IncludeAllSubFeature
|
|
||||||
|
|
||||||
if (Test-IsWin16) {
|
foreach ($feature in $windowsFeatures) {
|
||||||
Install-WindowsFeature -Name BITS -IncludeAllSubFeature
|
if ($feature.optionalFeature) {
|
||||||
Install-WindowsFeature -Name DSC-Service
|
Write-Host "Activating Windows Optional Feature '$($feature.name)'..."
|
||||||
}
|
Enable-WindowsOptionalFeature -Online -FeatureName $feature.name -NoRestart
|
||||||
|
|
||||||
# Install FS-iSCSITarget-Server
|
$resultSuccess = $?
|
||||||
$fsResult = Install-WindowsFeature -Name FS-iSCSITarget-Server -IncludeAllSubFeature -IncludeManagementTools
|
} else {
|
||||||
if ( $fsResult.Success ) {
|
Write-Host "Activating Windows Feature '$($feature.name)'..."
|
||||||
Write-Host "FS-iSCSITarget-Server has been successfully installed"
|
$Arguments = @{
|
||||||
} else {
|
Name = $feature.name
|
||||||
Write-Host "Failed to install FS-iSCSITarget-Server"
|
IncludeAllSubFeature = [System.Convert]::ToBoolean($feature.includeAllSubFeatures)
|
||||||
exit 1
|
IncludeManagementTools = [System.Convert]::ToBoolean($feature.includeManagementTools)
|
||||||
}
|
}
|
||||||
|
$result = Install-WindowsFeature @Arguments
|
||||||
|
|
||||||
Write-Host "Install Containers feature"
|
$resultSuccess = $result.Success
|
||||||
Install-WindowsFeature -Name Containers
|
}
|
||||||
|
|
||||||
Invoke-PesterTests -TestFile "WindowsFeatures" -TestName "ContainersFeature"
|
if ($resultSuccess) {
|
||||||
|
Write-Host "Windows Feature '$($feature.name)' was activated successfully"
|
||||||
|
} else {
|
||||||
|
throw "Failed to activate Windows Feature '$($feature.name)'"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +1,17 @@
|
|||||||
Describe "WindowsFeatures" {
|
Describe "WindowsFeatures" {
|
||||||
|
$windowsFeatures = (Get-ToolsetContent).windowsFeatures
|
||||||
|
$testCases = $windowsFeatures | ForEach-Object { @{ Name = $_.name; OptionalFeature = $_.optionalFeature } }
|
||||||
|
|
||||||
$testCases = @(
|
It "Windows Feature <Name> is installed" -TestCases $testCases {
|
||||||
@{ FeatureName = "NET-Framework-Features" }
|
if ($OptionalFeature) {
|
||||||
@{ FeatureName = "NET-Framework-45-Features" }
|
(Get-WindowsOptionalFeature -Online -FeatureName $Name).State | Should -Be "Enabled"
|
||||||
@{ FeatureName = "FS-iSCSITarget-Server" }
|
} else {
|
||||||
)
|
(Get-WindowsFeature -Name $Name).InstallState | Should -Be "Installed"
|
||||||
|
|
||||||
if (Test-isWin16) {
|
|
||||||
$testCases += @{ FeatureName = "BITS" }
|
|
||||||
$testCases += @{ FeatureName = "DSC-Service" }
|
|
||||||
}
|
|
||||||
if (Test-isWin19) {
|
|
||||||
$testCases += @{ FeatureName = "Microsoft-Windows-Subsystem-Linux" }
|
|
||||||
}
|
|
||||||
|
|
||||||
It "Windows Feature <FeatureName> is installed" -TestCases $testCases {
|
|
||||||
(Get-WindowsFeature -Name $FeatureName).InstallState | Should -Be "Installed"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Test-isWin19) {
|
|
||||||
it "Check WSL is on path" {
|
|
||||||
(Get-Command -Name 'wsl') | Should -BeTrue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Describe "ContainersFeature" {
|
it "Check WSL is on path" -Skip:(-not (Test-IsWin19)) {
|
||||||
It "Windows containers feature is installed" {
|
(Get-Command -Name 'wsl') | Should -BeTrue
|
||||||
(Get-WindowsFeature -Name "Containers").InstallState | Should -Be "Installed"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,14 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"windowsFeatures": [
|
||||||
|
{ "name": "NET-Framework-Features", "includeAllSubFeatures": true },
|
||||||
|
{ "name": "NET-Framework-45-Features", "includeAllSubFeatures": true },
|
||||||
|
{ "name": "BITS", "includeAllSubFeatures": true },
|
||||||
|
{ "name": "DSC-Service" },
|
||||||
|
{ "name": "FS-iSCSITarget-Server", "includeAllSubFeatures": true, "includeManagementTools": true },
|
||||||
|
{ "name": "Containers" }
|
||||||
|
],
|
||||||
"visualStudio": {
|
"visualStudio": {
|
||||||
"version" : "2017",
|
"version" : "2017",
|
||||||
"subversion" : "15",
|
"subversion" : "15",
|
||||||
|
|||||||
@@ -248,6 +248,12 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"windowsFeatures": [
|
||||||
|
{ "name": "NET-Framework-Features", "includeAllSubFeatures": true },
|
||||||
|
{ "name": "NET-Framework-45-Features", "includeAllSubFeatures": true },
|
||||||
|
{ "name": "FS-iSCSITarget-Server", "includeAllSubFeatures": true, "includeManagementTools": true },
|
||||||
|
{ "name": "Containers" }
|
||||||
|
],
|
||||||
"visualStudio": {
|
"visualStudio": {
|
||||||
"version" : "2019",
|
"version" : "2019",
|
||||||
"subversion" : "16",
|
"subversion" : "16",
|
||||||
|
|||||||
Reference in New Issue
Block a user