diff --git a/extras/dgoss/README.md b/extras/dgoss/README.md index 8dd1d827..218e40d0 100644 --- a/extras/dgoss/README.md +++ b/extras/dgoss/README.md @@ -80,6 +80,21 @@ This allows the user to leverage the `goss add|autoadd` commands to write tests The following environment variables can be set to change the behavior of dgoss. +#### DEBUG + +Enables debug output of `dgoss`. + +When running in debug mode, the tmp dir with the container output will not be cleaned up. + +Note: Debug output of `dgoss` is from `dgoss` shell script and not debug output of `goss` +(`dgoss run -e GOSS_LOGLEVEL=DEBUG jenkins:alpine`). + +**Default:** empty + +**Example:** + +`DEBUG=true dgoss run jenkins:alpine` + #### GOSS_PATH Location of the goss binary to use. (Default: `$(which goss)`) diff --git a/extras/dgoss/dgoss b/extras/dgoss/dgoss index 962d429c..498c6ebb 100755 --- a/extras/dgoss/dgoss +++ b/extras/dgoss/dgoss @@ -1,6 +1,7 @@ #!/bin/bash set -e +[ "$DEBUG" ] && set -x USAGE="USAGE: $(basename "$0") [run|edit] " GOSS_FILES_PATH="${GOSS_FILES_PATH:-.}" @@ -22,7 +23,7 @@ cleanup() { if [ -n "$CONTAINER_LOG_OUTPUT" ]; then cp "$tmp_dir/docker_output.log" "$CONTAINER_LOG_OUTPUT" fi - rm -rf "$tmp_dir" + [ "$DEBUG" ] || rm -rf "$tmp_dir" if [[ $id ]];then info "Deleting container" $CONTAINER_RUNTIME rm -vf "$id" > /dev/null