Skip to content

Commit 11a5832

Browse files
moskybtriarius
authored andcommitted
Accursed plusses
1 parent 4e95386 commit 11a5832

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packer/windows/conf/bin/bk-install-elastic-stack.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ tracing-backend=${Env:BUILDKITE_AGENT_TRACING_BACKEND}
146146
"@
147147
$OFS=" "
148148

149-
nssm set lifecycled AppEnvironmentExtra :AWS_REGION=$Env:AWS_REGION
149+
nssm set lifecycled AppEnvironmentExtra +AWS_REGION=$Env:AWS_REGION
150150
nssm set lifecycled AppEnvironmentExtra +LIFECYCLED_HANDLER="C:\buildkite-agent\bin\stop-agent-gracefully.ps1"
151151
Restart-Service lifecycled
152152

@@ -222,16 +222,16 @@ If ($lastexitcode -ne 0) { Exit $lastexitcode }
222222
nssm set buildkite-agent AppStderr C:\buildkite-agent\buildkite-agent.log
223223
If ($lastexitcode -ne 0) { Exit $lastexitcode }
224224

225-
nssm set buildkite-agent AppEnvironmentExtra :HOME=C:\buildkite-agent
225+
nssm set buildkite-agent AppEnvironmentExtra +HOME=C:\buildkite-agent
226226

227227
If ((![string]::IsNullOrEmpty($Env:BUILDKITE_ENV_FILE_URL)) -And (Test-Path -Path C:\buildkite-agent\env -PathType leaf)) {
228228
foreach ($var in Get-Content C:\buildkite-agent\env) {
229-
nssm set buildkite-agent AppEnvironmentExtra $var
229+
nssm set buildkite-agent AppEnvironmentExtra "+$var"
230230
If ($lastexitcode -ne 0) { Exit $lastexitcode }
231231
}
232232
}
233233

234-
nssm set buildkite-agent AppEnvironmentExtra BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB=$Env:BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB
234+
nssm set buildkite-agent AppEnvironmentExtra +BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB=$Env:BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB
235235
If ($lastexitcode -ne 0) { Exit $lastexitcode }
236236

237237
nssm set buildkite-agent AppExit Default Restart

packer/windows/conf/buildkite-agent/scripts/terminate-instance.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ aws autoscaling terminate-instance-in-auto-scaling-group --region "$Region" --in
99
if ($lastexitcode -eq 0) { # If autoscaling request was successful, we will terminate
1010
Write-Output "terminate-instance: disabling buildkite-agent service"
1111
nssm stop buildkite-agent
12-
}
13-
else {
12+
} else {
1413
Write-Output "terminate-instance: ASG could not decrement (we're already at minSize)"
15-
Stop-Computer -ComputerName "localhost" -Force
14+
if ($Env:BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB -eq "true") {
15+
Write-Output "terminate-instance: terminating instance anyway"
16+
Stop-Computer -ComputerName "localhost" -Force
17+
}
1618
}

0 commit comments

Comments
 (0)