Skip to content

Commit 00a3458

Browse files
authored
[chore][ci] Gitlab use downgraded version of chocolatey on ServerCore:2019 (#7051)
1 parent afc9fc9 commit 00a3458

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.gitlab/windows/runner-setup-helpers.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ function Confirm-Sha256 {
112112

113113
<#
114114
.SYNOPSIS
115-
Installs a hard-coded version of Chocolatey.
115+
Installs a hard-coded version of Chocolatey. If $Env:WIN_VERSION is "2019",
116+
installs a version compatible with Windows ServerCore 2019.
116117
117118
.DESCRIPTION
118119
This function installs a hard-coded version of Chocolatey, by downloading the
@@ -147,8 +148,16 @@ function Install-Chocolatey {
147148
throw
148149
}
149150

151+
150152
$chocolateyVersion = "2.6.0"
151153
$knownHash = "f13a2af9cd4ec2c9b58d81861bc95ad7151e3a871d8f758dffa72a996a3792d8"
154+
if ($env:WIN_VERSION -eq "2019") {
155+
# Use a version of Chocolatey that works on Windows ServerCore 2019.
156+
# After 1.4.4, Chocolatey requires .NET 4.8, which can't be installed on
157+
# ServerCore 2019.
158+
$chocolateyVersion = "1.4.4"
159+
$knownHash = "c49fdb49487e0e7a6fdb6d14ffc010630c0b40854942bac13b08bd0e4dac1bf4"
160+
}
152161

153162
$nupkgDirectory = Join-Path -Path $Env:TEMP -ChildPath "nupkg"
154163
$chocoNupkgPath = Get-ChocolateyNupkg -PackageName "chocolatey" -Version $chocolateyVersion -DestinationDirectory $nupkgDirectory

0 commit comments

Comments
 (0)