Skip to content

Commit

Permalink
Generalize Windows CI setup script for any user.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aznashwan committed Nov 16, 2021
1 parent 3d6bfa3 commit 444ef2f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions script/setup/prepare_env_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 444ef2f

Please sign in to comment.