Skip to content

Commit 32ecb43

Browse files
committed
fix: Add trap to agent startup script to sleep on failure
The Docker Terraform provider removes containers immediately on exit, making it difficult to debug a failed container start with Coder. This will sleep on exit and output a friendly log, which should assist with debugging failures.
1 parent 08a781f commit 32ecb43

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

provisionersdk/agent.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Start-Process -FilePath $env:TEMP\sshd.exe -ArgumentList "agent" -PassThru`
1818

1919
linuxScript = `#!/usr/bin/env sh
2020
set -eux pipefail
21+
trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code $?. Sleeping infinitely to preserve logs... && sleep infinity' EXIT
2122
BINARY_DIR=$(mktemp -d -t coder.XXXXXX)
2223
BINARY_NAME=coder
2324
BINARY_URL=${ACCESS_URL}bin/coder-linux-${ARCH}
@@ -39,6 +40,7 @@ exec ./$BINARY_NAME agent`
3940

4041
darwinScript = `#!/usr/bin/env sh
4142
set -eux pipefail
43+
trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code $?. Sleeping infinitely to preserve logs... && sleep infinity' EXIT
4244
BINARY_DIR=$(mktemp -d -t coder.XXXXXX)
4345
BINARY_NAME=coder
4446
cd $BINARY_DIR

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy