Skip to content

Commit 7eceeb9

Browse files
authored
Merge pull request #5571 from adelina-t/win_set_specific_go_version
Install specific golang version in Windows CI.
2 parents 25d7f90 + 419d616 commit 7eceeb9

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

script/setup/prepare_env_windows.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Prepare windows environment for building and running containerd tests
22

3-
$PACKAGES= "mingw", "git", "golang", "make"
3+
$PACKAGES= @{ mingw = ""; git = ""; golang = "1.16.4"; make = "" }
44

55
write-host "Downloading chocolatey package"
66
curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip'
@@ -14,8 +14,13 @@ $env:PATH+=";C:\ProgramData\chocolatey\bin"
1414

1515
write-host "Install necessary packages"
1616

17-
foreach ($package in $PACKAGES) {
18-
choco.exe install $package --yes
17+
foreach ($package in $PACKAGES.Keys) {
18+
$command = "choco.exe install $package --yes"
19+
$version = $PACKAGES[$package]
20+
if (-Not [string]::IsNullOrEmpty($version)) {
21+
$command += " --version $version"
22+
}
23+
Invoke-Expression $command
1924
}
2025

2126
write-host "Set up environment."
@@ -37,4 +42,4 @@ go get -u github.com/jstemmer/go-junit-report
3742
$CRICTL_DOWNLOAD_URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-windows-amd64.tar.gz"
3843
curl.exe -L $CRICTL_DOWNLOAD_URL -o c:\crictl.tar.gz
3944
tar -xvf c:\crictl.tar.gz
40-
mv crictl.exe c:\Users\azureuser\go\bin\crictl.exe # Move crictl somewhere in path
45+
mv crictl.exe c:\Users\azureuser\go\bin\crictl.exe # Move crictl somewhere in path

0 commit comments

Comments
 (0)