Skip to content

Commit a947a79

Browse files
committed
entrypoint-aws-batch: Let NEXTSTRAIN_AWS_BATCH_VERBOSE=0 turn off set -x
Useful for upcoming Cram tests where I don't want to match all `set -x` output. Nicer to turn it off than to filter it out with grep.
1 parent 47aeace commit a947a79

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

entrypoint-aws-batch

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
set -euo pipefail
33

44
# Show what we're running for the benefit of the logs.
5-
set -x
5+
if [[ "${NEXTSTRAIN_AWS_BATCH_VERBOSE:=1}" != 0 ]]; then
6+
set -x
7+
fi
68

79
# Download the working dir.
810
case "$NEXTSTRAIN_AWS_BATCH_WORKDIR_URL" in

tests/aws-batch-verbose.t

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env cram
2+
3+
Setup.
4+
5+
$ : "${IMAGE:=localhost:5000/nextstrain/base:latest}"
6+
$ (docker image inspect "$IMAGE" || docker image pull "$IMAGE") &>/dev/null
7+
8+
A workdir URL is required and not setting one here causes the entrypoint to
9+
error, but that's enough for testing verbose mode.
10+
11+
$ export NEXTSTRAIN_AWS_BATCH_WORKDIR_URL=
12+
13+
Verbose mode is default.
14+
15+
$ docker run --rm --env=NEXTSTRAIN_AWS_BATCH_WORKDIR_URL "$IMAGE" \
16+
> /sbin/entrypoint-aws-batch true
17+
+ case "$NEXTSTRAIN_AWS_BATCH_WORKDIR_URL" in
18+
+ echo 'entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>'
19+
entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>
20+
+ exit 1
21+
[1]
22+
23+
Verbose mode is anything not zero.
24+
25+
$ docker run --rm --env=NEXTSTRAIN_AWS_BATCH_{WORKDIR_URL,VERBOSE=yes} "$IMAGE" \
26+
> /sbin/entrypoint-aws-batch true
27+
+ case "$NEXTSTRAIN_AWS_BATCH_WORKDIR_URL" in
28+
+ echo 'entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>'
29+
entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>
30+
+ exit 1
31+
[1]
32+
33+
$ docker run --rm --env=NEXTSTRAIN_AWS_BATCH_{WORKDIR_URL,VERBOSE=} "$IMAGE" \
34+
> /sbin/entrypoint-aws-batch true
35+
+ case "$NEXTSTRAIN_AWS_BATCH_WORKDIR_URL" in
36+
+ echo 'entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>'
37+
entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>
38+
+ exit 1
39+
[1]
40+
41+
Verbose mode can be turned off.
42+
43+
$ docker run --rm --env=NEXTSTRAIN_AWS_BATCH_{WORKDIR_URL,VERBOSE=0} "$IMAGE" \
44+
> /sbin/entrypoint-aws-batch true
45+
entrypoint-aws-batch: No handler for NEXTSTRAIN_AWS_BATCH_WORKDIR_URL <>
46+
[1]

0 commit comments

Comments
 (0)