Skip to content

Commit

Permalink
dgoss: add flag for debugging (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
dklimpel authored Nov 5, 2024
1 parent 7a3bcda commit 6434d95
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions extras/dgoss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`)
Expand Down
3 changes: 2 additions & 1 deletion extras/dgoss/dgoss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e
[ "$DEBUG" ] && set -x

USAGE="USAGE: $(basename "$0") [run|edit] <docker_run_params>"
GOSS_FILES_PATH="${GOSS_FILES_PATH:-.}"
Expand All @@ -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
Expand Down

0 comments on commit 6434d95

Please sign in to comment.