Skip to content

Commit 9e3b67c

Browse files
committed
warn, not error, on startup
1 parent 7e3226d commit 9e3b67c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

registry/coder-labs/modules/archive/run.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,12 @@ echo "Installed extract script to: $EXTRACT_WRAPPER_PATH"
6464
if [[ $EXTRACT_ON_START = true ]]; then
6565
. "$LIB_PATH"
6666

67-
archive_wait_and_extract "$EXTRACT_WAIT_TIMEOUT"
67+
archive_wait_and_extract "$EXTRACT_WAIT_TIMEOUT" quiet || {
68+
exit_code=$?
69+
if [[ $exit_code -eq 2 ]]; then
70+
echo "WARNING: Archive not found in backup path (this is expected with new workspaces)."
71+
else
72+
exit $exit_code
73+
fi
74+
}
6875
fi

registry/coder-labs/modules/archive/scripts/archive-lib.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# set -x
5-
64
log() {
75
printf '%s\n' "$@" >&2
86
}
@@ -253,6 +251,7 @@ archive_wait_and_extract() {
253251
load_defaults
254252

255253
local timeout="${1:-300}"
254+
local quiet="${2:-}"
256255
local file="${DEFAULT_ARCHIVE_PATH}"
257256

258257
local start now
@@ -273,6 +272,8 @@ archive_wait_and_extract() {
273272
sleep 5
274273
done
275274

276-
printf 'ERROR: Timed out waiting for archive: %s\n' "$file" >&2
277-
return 1
275+
if [[ -z $quiet ]]; then
276+
printf 'ERROR: Timed out waiting for archive: %s\n' "$file" >&2
277+
fi
278+
return 2
278279
}

0 commit comments

Comments
 (0)