Skip to content

Commit

Permalink
Merge pull request #1 from akv-platform/malob/deprecate-software
Browse files Browse the repository at this point in the history
Deprecate known software from Windows Server 2022
  • Loading branch information
Maxim Lobanov authored Aug 2, 2021
2 parents 076e24c + c1b33a5 commit b29da87
Show file tree
Hide file tree
Showing 26 changed files with 236 additions and 277 deletions.
1 change: 1 addition & 0 deletions images/win/scripts/ImageHelpers/ImageHelpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Export-ModuleMember -Function @(
'Install-VsixExtension'
'Get-VSExtensionVersion'
'Get-WinVersion'
'Test-IsWin22'
'Test-IsWin19'
'Test-IsWin16'
'Choco-Install'
Expand Down
6 changes: 6 additions & 0 deletions images/win/scripts/ImageHelpers/InstallHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ function Get-WinVersion
(Get-CimInstance -ClassName Win32_OperatingSystem).Caption
}

function Test-IsWin22
{
(Get-WinVersion) -match "2022"
}

function Test-IsWin19
{
(Get-WinVersion) -match "2019"
Expand Down Expand Up @@ -416,6 +421,7 @@ function Install-AndroidSDKPackages {
[Parameter(Mandatory=$true)]
[string]$AndroidSDKRootPath,
[Parameter(Mandatory=$true)]
[AllowEmptyCollection()]
[string[]]$AndroidPackages,
[string] $PrefixPackageName
)
Expand Down
7 changes: 7 additions & 0 deletions images/win/scripts/Installers/Install-AndroidSDK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
-AndroidSDKRootPath $sdkRoot `
-AndroidPackages $androidNDKs

# Old skdmanager from sdk tools doesn't work with Java > 8, set version 8 explicitly
if (Test-IsWin22) {
$oldSdkManagerPath = "$sdkRoot\tools\bin\sdkmanager.bat"
$contentToPrepend = @("set JAVA_HOME=$($env:JAVA_HOME_8_X64)")
$contentToPrepend + (Get-Content -Path $oldSdkManagerPath) | Set-Content -Path $oldSdkManagerPath
}

$ndkLTSVersion = $ndkLTSPackageName.Split(';')[1]
$ndkLatestVersion = $ndkLatestPackageName.Split(';')[1]

Expand Down
13 changes: 7 additions & 6 deletions images/win/scripts/Installers/Install-Docker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
## can continue.
################################################################################

Write-Host "Install-Package Docker"
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
Start-Service docker
# TO-DO: Will be fixed with https://github.com/actions/virtual-environments-internal/issues/2512
# Write-Host "Install-Package Docker"
# Install-Package -Name docker -ProviderName DockerMsftProvider -Force
# Start-Service docker

Write-Host "Install-Package Docker-Compose"
Choco-Install -PackageName docker-compose
# Write-Host "Install-Package Docker-Compose"
# Choco-Install -PackageName docker-compose

$dockerImages = (Get-ToolsetContent).docker.images
foreach ($dockerImage in $dockerImages) {
Expand All @@ -23,4 +24,4 @@ foreach ($dockerImage in $dockerImages) {
}
}

Invoke-PesterTests -TestFile "Docker"
# Invoke-PesterTests -TestFile "Docker"
19 changes: 14 additions & 5 deletions images/win/scripts/Installers/Install-DotnetSDK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
$SdkVersion,
$Warmup
Expand All @@ -44,15 +56,12 @@ function InstallSDKVersion (
Write-Host "Sdk version $sdkVersion already installed"
}

# Fix for issue 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
Fix-ImportPublishProfile -SdkVersion $SdkVersion

if ($Warmup) {
Invoke-Warmup -SdkVersion $SdkVersion
}

}

function InstallAllValidSdks()
Expand Down
105 changes: 62 additions & 43 deletions images/win/scripts/Installers/Install-Msys2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,68 @@
$dash = "-" * 40
$origPath = $env:PATH

$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object {
$_.name -match "^msys2-x86_64" -and $_.name.EndsWith(".exe") }).browser_download_url
function Install-Msys2 {
$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object {
$_.name -match "^msys2-x86_64" -and $_.name.EndsWith(".exe") }).browser_download_url

# Download the latest msys2 x86_64, filename includes release date
Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])"
$msys2File = Start-DownloadWithRetry -Url $msys2Uri
Write-Host "Finished download"
# Download the latest msys2 x86_64, filename includes release date
Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])"
$msys2File = Start-DownloadWithRetry -Url $msys2Uri
Write-Host "Finished download"

# extract tar.xz to C:\
Write-Host "Starting msys2 installation"
& $msys2File in --confirm-command --accept-messages --root C:/msys64
Remove-Item $msys2File
# extract tar.xz to C:\
Write-Host "Starting msys2 installation"
& $msys2File in --confirm-command --accept-messages --root C:/msys64
Remove-Item $msys2File
}

function Install-Msys2Packages($Packages) {
if (-not $Packages) {
return
}

Write-Host "`n$dash Install msys2 packages"
pacman.exe -S --noconfirm --needed --noprogressbar $Packages
taskkill /f /fi "MODULES eq msys-2.0.dll"

Write-Host "`n$dash Remove p7zip/7z package due to conflicts"
pacman.exe -R --noconfirm --noprogressbar p7zip
}

function Install-MingwPackages($Packages) {
if (-not $Packages) {
return
}

Write-Host "`n$dash Install mingw packages"
$archs = $Packages.arch

foreach ($arch in $archs) {
Write-Host "Installing $arch packages"
$archPackages = $toolsetContent.mingw | Where-Object { $_.arch -eq $arch }
$runtimePackages = $archPackages.runtime_packages.name | ForEach-Object { "${arch}-$_" }
$additionalPackages = $archPackages.additional_packages | ForEach-Object { "${arch}-$_" }
$packagesToInstall = $runtimePackages + $additionalPackages
Write-Host "The following packages will be installed: $packagesToInstall"
pacman.exe -S --noconfirm --needed --noprogressbar $packagesToInstall
}

# clean all packages to decrease image size
Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm

$pkgs = pacman.exe -Q

foreach ($arch in $archs)
{
Write-Host "`n$dash Installed $arch packages"
$pkgs | grep ^${arch}-
}
}


Install-Msys2

# Add msys2 bin tools folders to PATH temporary
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath"
Expand All @@ -35,38 +84,8 @@ pacman.exe -Syuu --noconfirm
taskkill /f /fi "MODULES eq msys-2.0.dll"

$toolsetContent = (Get-ToolsetContent).MsysPackages
Write-Host "`n$dash Install msys2 packages"
$msys2Packages = $toolsetContent.msys2
pacman.exe -S --noconfirm --needed --noprogressbar $msys2Packages
taskkill /f /fi "MODULES eq msys-2.0.dll"

Write-Host "`n$dash Remove p7zip/7z package due to conflicts"
pacman.exe -R --noconfirm --noprogressbar p7zip

# install mingw packages
$archs = $toolsetContent.mingw.arch
foreach ($arch in $archs)
{
Write-Host "Installing $arch packages"
$archPackages = $toolsetContent.mingw | Where-Object { $_.arch -eq $arch }
$runtimePackages = $archPackages.runtime_packages.name | ForEach-Object { "${arch}-$_" }
$additionalPackages = $archPackages.additional_packages | ForEach-Object { "${arch}-$_" }
$packagesToInstall = $runtimePackages + $additionalPackages
Write-Host "The following packages will be installed: $packagesToInstall"
pacman.exe -S --noconfirm --needed --noprogressbar $packagesToInstall
}

# clean all packages to decrease image size
Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm

$pkgs = pacman.exe -Q

foreach ($arch in $archs)
{
Write-Host "`n$dash Installed $arch packages"
$pkgs | grep ^${arch}-
}
Install-Msys2Packages -Packages $toolsetContent.msys2
Install-MingwPackages -Packages $toolsetContent.mingw

$env:PATH = $origPath
Write-Host "`nMSYS2 installation completed"
Expand Down
5 changes: 3 additions & 2 deletions images/win/scripts/Installers/Install-NET48.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $InstallerName = "ndp48-devpack-enu.exe"
$InstallerUrl = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0307177e14752e359fde5423ab583e43/${InstallerName}"
$ArgumentList = ("Setup", "/passive", "/norestart")

Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList
# TO-DO: Will be fixed with https://github.com/actions/virtual-environments-internal/issues/2513
# Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList

Invoke-PesterTests -TestFile "Tools" -TestName "NET48"
# Invoke-PesterTests -TestFile "Tools" -TestName "NET48"
2 changes: 1 addition & 1 deletion images/win/scripts/Installers/Install-PostgreSQL.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Set-SystemVariable -SystemVariable PGUSER -Value $pgUser
Set-SystemVariable -SystemVariable PGPASSWORD -Value $pgPwd

#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
$pgPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName
Expand Down
6 changes: 5 additions & 1 deletion images/win/scripts/Installers/Install-WDK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ if (Test-IsWin19)
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"
$VSver = "2019"
}
else
elseif (Test-IsWin16)
{
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156"
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"
$VSver = "2017"
}
else
{
throw "Invalid version of Visual Studio is found. Either 2017 or 2019 are required"
}

$argumentList = ("/features", "+", "/quiet")

Expand Down
24 changes: 12 additions & 12 deletions images/win/scripts/Installers/Install-WindowsFeatures.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ if (Test-IsWin16) {
Install-WindowsFeature -Name DSC-Service
}

# Install FS-iSCSITarget-Server
$fsResult = Install-WindowsFeature -Name FS-iSCSITarget-Server -IncludeAllSubFeature -IncludeManagementTools
if ( $fsResult.Success ) {
Write-Host "FS-iSCSITarget-Server has been successfully installed"
} else {
Write-Host "Failed to install FS-iSCSITarget-Server"
exit 1
}

Write-Host "Install Containers feature"
Install-WindowsFeature -Name Containers
if (Test-IsWin16 -or Test-IsWin19) {
# Install FS-iSCSITarget-Server
$fsResult = Install-WindowsFeature -Name FS-iSCSITarget-Server -IncludeAllSubFeature -IncludeManagementTools
if ( $fsResult.Success ) {
Write-Host "FS-iSCSITarget-Server has been successfully installed"
} else {
Write-Host "Failed to install FS-iSCSITarget-Server"
exit 1
}

Invoke-PesterTests -TestFile "WindowsFeatures" -TestName "ContainersFeature"
Write-Host "Install Containers feature"
Install-WindowsFeature -Name Containers
}
9 changes: 7 additions & 2 deletions images/win/scripts/Installers/Install-Wix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@

Choco-Install -PackageName wixtoolset -ArgumentList "--force"

if(Test-IsWin19)
if (Test-IsWin19)
{
$extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix"
$VSver = "2019"
}
else
elseif (Test-IsWin16)
{
$extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix"
$VSver = "2017"
}
else
{
throw "Invalid version of Visual Studio is found. Either 2017 or 2019 are required"
}

$extensionName = "Votive$VSver.vsix"

#Installing VS extension 'Wix Toolset Visual Studio Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver

Expand Down
2 changes: 0 additions & 2 deletions images/win/scripts/Installers/Update-DotnetTLS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ if(Test-Path $registryPath){
Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD
}

Invoke-PesterTests -TestFile "Tools" -TestName "DotnetTLS"

14 changes: 8 additions & 6 deletions images/win/scripts/Installers/Update-ImageData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ $imageVersion = $env:IMAGE_VERSION
$imageDataFile = $env:IMAGEDATA_FILE
$githubUrl="https://github.com/actions/virtual-environments/blob"

if ($caption -match "2019")
{
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}"
}

if ($caption -match "2016")
{
} elseif (Test-IsWin16) {
$imageLabel = "windows-2016"
$softwareUrl = "${githubUrl}/win16/${imageVersion}/images/win/Windows2016-Readme.md"
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win16%2F${imageVersion}"
} else {
throw "Invalid platform version is found. Either Windows Server 2016 or 2019 or 2022 are required"
}

$json = @"
Expand Down
17 changes: 11 additions & 6 deletions images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,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
Expand Down
Loading

0 comments on commit b29da87

Please sign in to comment.