Skip to content

Commit d2927cf

Browse files
committed
Mark as unhealthy on windows
1 parent f9d7731 commit d2927cf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ if ($lastexitcode -eq 0) { # If autoscaling request was successful, we will term
1212
} else {
1313
Write-Output "terminate-instance: ASG could not decrement (we're already at minSize)"
1414
if ($Env:BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB -eq "true") {
15-
Write-Output "terminate-instance: terminating instance anyway"
16-
Stop-Computer -ComputerName "localhost" -Force
15+
Write-Output "terminate-instance: marking instance as unhealthy"
16+
aws autoscaling set-instance-health `
17+
--instance-id "$InstanceId" `
18+
--region "$Region" `
19+
--health-status Unhealthy `
20+
--no-should-respect-grace-period
1721
}
1822
}

0 commit comments

Comments
 (0)