Skip to content

Commit 1973786

Browse files
kylecarbsmafredri
andauthored
fix: Add trap to agent startup script to sleep on failure (#2873)
* 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. * Update provisionersdk/agent.go Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> * Update provisionersdk/agent.go Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
1 parent 3e279b6 commit 1973786

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

provisionersdk/scripts/bootstrap_darwin.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env sh
22
set -eux pipefail
3+
trap 'echo === Agent script exited with non-zero code. Sleeping 24h to preserve logs... && sleep 86400' EXIT
34
BINARY_DIR=$(mktemp -d -t coder.XXXXXX)
45
BINARY_NAME=coder
56
cd "$BINARY_DIR"

provisionersdk/scripts/bootstrap_linux.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env sh
22
set -eux pipefail
3+
trap 'echo === Agent script exited with non-zero code. Sleeping 24h to preserve logs... && sleep 86400' EXIT
34
BINARY_DIR=$(mktemp -d -t coder.XXXXXX)
45
BINARY_NAME=coder
56
BINARY_URL=${ACCESS_URL}bin/coder-linux-${ARCH}

0 commit comments

Comments
 (0)