File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ tracing-backend=${Env:BUILDKITE_AGENT_TRACING_BACKEND}
146
146
"@
147
147
$OFS = " "
148
148
149
- nssm set lifecycled AppEnvironmentExtra : AWS_REGION= $Env: AWS_REGION
149
+ nssm set lifecycled AppEnvironmentExtra + AWS_REGION= $Env: AWS_REGION
150
150
nssm set lifecycled AppEnvironmentExtra + LIFECYCLED_HANDLER= " C:\buildkite-agent\bin\stop-agent-gracefully.ps1"
151
151
Restart-Service lifecycled
152
152
@@ -222,16 +222,16 @@ If ($lastexitcode -ne 0) { Exit $lastexitcode }
222
222
nssm set buildkite- agent AppStderr C:\buildkite- agent\buildkite- agent.log
223
223
If ($lastexitcode -ne 0 ) { Exit $lastexitcode }
224
224
225
- nssm set buildkite- agent AppEnvironmentExtra : HOME= C:\buildkite- agent
225
+ nssm set buildkite- agent AppEnvironmentExtra + HOME= C:\buildkite- agent
226
226
227
227
If ((! [string ]::IsNullOrEmpty($Env: BUILDKITE_ENV_FILE_URL )) -And (Test-Path - Path C:\buildkite- agent\env - PathType leaf)) {
228
228
foreach ($var in Get-Content C:\buildkite- agent\env) {
229
- nssm set buildkite- agent AppEnvironmentExtra $var
229
+ nssm set buildkite- agent AppEnvironmentExtra " + $var "
230
230
If ($lastexitcode -ne 0 ) { Exit $lastexitcode }
231
231
}
232
232
}
233
233
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
235
235
If ($lastexitcode -ne 0 ) { Exit $lastexitcode }
236
236
237
237
nssm set buildkite- agent AppExit Default Restart
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ aws autoscaling terminate-instance-in-auto-scaling-group --region "$Region" --in
9
9
if ($lastexitcode -eq 0 ) { # If autoscaling request was successful, we will terminate
10
10
Write-Output " terminate-instance: disabling buildkite-agent service"
11
11
nssm stop buildkite- agent
12
- }
13
- else {
12
+ } else {
14
13
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
+ }
16
18
}
You can’t perform that action at this time.
0 commit comments