Skip to content

Commit

Permalink
Enable bash debug mode when debug is true (#460)
Browse files Browse the repository at this point in the history
* Set -x when debug mode true

* Update description of debug parameter
  • Loading branch information
marboledacci authored Sep 17, 2024
1 parent 49b74e1 commit 5be0c44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/commands/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ parameters:
default: true
debug:
description: |
Runs scripts in debug mode for bash.
Enable to view full payload being sent to Slack and response being received from the API call.
Redacted content can be viewed by re-running the job with SSH and accessing the log files referenced in the job output.
When run in a persistent build environment such as CircleCI Runner, these debug log files may remain in the system's temporary filesystem indefinitely and accumulate over time.
Expand Down
1 change: 1 addition & 0 deletions src/jobs/on-hold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ parameters:
default: $SLACK_DEFAULT_CHANNEL
debug:
description: |
Runs scripts in debug mode for bash.
View payload and response being sent to slack api.
Enable to view full payload being sent to slack and response being received from the API call.
type: boolean
Expand Down
5 changes: 5 additions & 0 deletions src/scripts/notify.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
# shellcheck disable=SC2016,SC3043

if [ "$SLACK_PARAM_DEBUG" -eq 1 ]; then
set -x
fi

# Import utils.
eval "$SLACK_SCRIPT_UTILS"
JQ_PATH=/usr/local/bin/jq
Expand Down Expand Up @@ -298,3 +302,4 @@ if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
BuildMessageBody
PostToSlack
fi
set +x

0 comments on commit 5be0c44

Please sign in to comment.