Skip to content

Commit fa937db

Browse files
committed
dgoss: add flag for debugging
1 parent 5704120 commit fa937db

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

extras/dgoss/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ This allows the user to leverage the `goss add|autoadd` commands to write tests
8080

8181
The following environment variables can be set to change the behavior of dgoss.
8282

83+
#### DEBUG
84+
85+
Enables debug output of `dgoss`.
86+
87+
When running in debug mode, the tmp dir with the container output will not be cleaned up.
88+
89+
Note: Debug output of `dgoss` is from `dgoss` shell script and not debug output of `goss`
90+
(`dgoss run -e GOSS_LOGLEVEL=DEBUG jenkins:alpine`).
91+
92+
**Default:** empty
93+
94+
**Example:**
95+
96+
`DEBUG=true dgoss run jenkins:alpine`
97+
8398
#### GOSS_PATH
8499

85100
Location of the goss binary to use. (Default: `$(which goss)`)

extras/dgoss/dgoss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
set -e
4+
[ "$DEBUG" ] && set -x
45

56
USAGE="USAGE: $(basename "$0") [run|edit] <docker_run_params>"
67
GOSS_FILES_PATH="${GOSS_FILES_PATH:-.}"
@@ -22,7 +23,7 @@ cleanup() {
2223
if [ -n "$CONTAINER_LOG_OUTPUT" ]; then
2324
cp "$tmp_dir/docker_output.log" "$CONTAINER_LOG_OUTPUT"
2425
fi
25-
rm -rf "$tmp_dir"
26+
[ "$DEBUG" ] || rm -rf "$tmp_dir"
2627
if [[ $id ]];then
2728
info "Deleting container"
2829
$CONTAINER_RUNTIME rm -vf "$id" > /dev/null

0 commit comments

Comments
 (0)