Generalize Windows CI setup script for any user.

The current Windows CI setup script assumes it will always be run under
the `azureuser` username.

While this username is defined in the Windows CI GitHub action, the
current version of the script both exposes us to a future risk of
breaking should the CI action be changed, and is also unfriendly to
`curl | sh`-ing it for quick test environment setups.

This patch makes the Windows CI setup script work with any username
provided they have administrative privileges.

Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
This commit is contained in:
Nashwan Azhari 2021-11-16 17:13:02 +02:00
parent 3d6bfa3f55
commit 444ef2f6d7

View File

@ -25,7 +25,8 @@ foreach ($package in $PACKAGES.Keys) {
Write-Host "Set up environment." Write-Host "Set up environment."
$path = ";c:\Program Files\Git\bin;c:\Program Files\Go\bin;c:\Users\azureuser\go\bin;c:\containerd\bin" $userGoBin = "${env:HOME}\go\bin"
$path = ";c:\Program Files\Git\bin;c:\Program Files\Go\bin;${userGoBin};c:\containerd\bin"
$env:PATH+=$path $env:PATH+=$path
Write-Host $env:PATH Write-Host $env:PATH
@ -42,4 +43,4 @@ go get -u github.com/jstemmer/go-junit-report
$CRICTL_DOWNLOAD_URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-windows-amd64.tar.gz" $CRICTL_DOWNLOAD_URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-windows-amd64.tar.gz"
curl.exe -L $CRICTL_DOWNLOAD_URL -o c:\crictl.tar.gz curl.exe -L $CRICTL_DOWNLOAD_URL -o c:\crictl.tar.gz
tar -xvf c:\crictl.tar.gz tar -xvf c:\crictl.tar.gz
mv crictl.exe c:\Users\azureuser\go\bin\crictl.exe # Move crictl somewhere in path mv crictl.exe "${userGoBin}\crictl.exe" # Move crictl somewhere in path