Skip to content

Commit 98f9074

Browse files
author
Chloe Hutchinson
committed
Fix error check, log everything to agent log
1 parent 2c15ca8 commit 98f9074

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ nssm set buildkite-agent AppExit Default Restart
172172
If ($lastexitcode -ne 0) { Exit $lastexitcode }
173173
nssm set buildkite-agent AppRestartDelay 5000
174174
If ($lastexitcode -ne 0) { Exit $lastexitcode }
175-
nssm set buildkite-agent AppEvents Exit/Post "powershell C:\buildkite-agent\bin\terminate-instance.ps1"
175+
nssm set buildkite-agent AppEvents Exit/Post "powershell C:\buildkite-agent\bin\terminate-instance.ps1 3>&1 2>&1 > C:\buildkite-agent\buildkite-agent.log"
176176
If ($lastexitcode -ne 0) { Exit $lastexitcode }
177177

178178
Restart-Service buildkite-agent

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Stop script execution when a non-terminating error occurs
2-
$ErrorActionPreference = "Stop"
3-
41
Write-Output "terminate-instance: waiting for 10 seconds to allow agent logs to drain to Cloudwatch..."
52
Start-Sleep -Seconds 10
63

0 commit comments

Comments
 (0)