From 444ef2f6d772085d6da9fe7bacecab3a714b334e Mon Sep 17 00:00:00 2001 From: Nashwan Azhari Date: Tue, 16 Nov 2021 17:13:02 +0200 Subject: [PATCH] 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 --- script/setup/prepare_env_windows.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/setup/prepare_env_windows.ps1 b/script/setup/prepare_env_windows.ps1 index 2d89e07c1..254305921 100644 --- a/script/setup/prepare_env_windows.ps1 +++ b/script/setup/prepare_env_windows.ps1 @@ -25,7 +25,8 @@ foreach ($package in $PACKAGES.Keys) { 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 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" curl.exe -L $CRICTL_DOWNLOAD_URL -o 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