From 97e6d2712b73772149b3949f13a80645c7a317b6 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 27 Oct 2022 22:33:07 -0400 Subject: [PATCH] Resolve incorrectly added env vars for Windows Signed-off-by: Peter Zhu --- lib/compute/agent-nodes.ts | 4 ++-- packer/scripts/windows/scoop-install-commons.ps1 | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/compute/agent-nodes.ts b/lib/compute/agent-nodes.ts index 483464bf..2fa541e9 100644 --- a/lib/compute/agent-nodes.ts +++ b/lib/compute/agent-nodes.ts @@ -148,7 +148,7 @@ export class AgentNodes { maxTotalUses: -1, minimumNumberOfSpareInstances: 2, numExecutors: 1, - amiId: 'ami-04e3e1e593eb9b709', + amiId: 'ami-0720b70e6cb2e8012', initScript: 'echo', remoteFs: 'C:\\Users\\Administrator\\jenkins', }; @@ -160,7 +160,7 @@ export class AgentNodes { maxTotalUses: 1, minimumNumberOfSpareInstances: 1, numExecutors: 1, - amiId: 'ami-04e3e1e593eb9b709', + amiId: 'ami-0720b70e6cb2e8012', initScript: 'echo', remoteFs: 'C:\\Users\\Administrator\\jenkins', }; diff --git a/packer/scripts/windows/scoop-install-commons.ps1 b/packer/scripts/windows/scoop-install-commons.ps1 index 721abbe9..f97b977d 100644 --- a/packer/scripts/windows/scoop-install-commons.ps1 +++ b/packer/scripts/windows/scoop-install-commons.ps1 @@ -19,8 +19,8 @@ $fileFound $gitPathFound = $fileFound.replace("$fileName", '') $gitPathFound # Add to EnvVar -$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") -[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";$gitPathFound", "User") +$userenv = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) +[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";$gitPathFound", [System.EnvironmentVariableTarget]::User) # Make sure mem size are set to avoid "Out of memory, malloc failed" issues on Windows git config --system core.packedGitLimit 128m git config --system core.packedGitWindowSize 128m @@ -57,7 +57,7 @@ $libPathFound = $libFound.replace("$libName", '') $libPathFound mv -v "$libFound" "$libPathFound\\$libNameRequired" # Add MINGW_BIN path to User Env Var for k-NN to retrieve libs -[System.Environment]::SetEnvironmentVariable("MINGW_BIN", "$libPathFound", "User") +[System.Environment]::SetEnvironmentVariable("MINGW_BIN", "$libPathFound", [System.EnvironmentVariableTarget]::User) # Install zlib for k-NN compilation requirements scoop install zlib @@ -114,9 +114,9 @@ Foreach ($nodeVersion in $nodeVersionList) } volta install yarn yarn --version -$userenv2 = [System.Environment]::GetEnvironmentVariable("Path", "User") +$userenv2 = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) $nodePathFixed = "C:\\Users\\Administrator\\scoop\\persist\\volta\\appdata\\bin" -[System.Environment]::SetEnvironmentVariable("PATH", $userenv2 + ";$nodePathFixed", "User") +[System.Environment]::SetEnvironmentVariable("PATH", $userenv2 + ";$nodePathFixed", [System.EnvironmentVariableTarget]::User) # Install ruby24 scoop install ruby24