Skip to content

Commit 917f8c5

Browse files
authored
Merge pull request #466 from concourse/debug-mode-370
add debug/verbose mode
2 parents 525b438 + 3a5ee7f commit 917f8c5

File tree

7 files changed

+77
-3
lines changed

7 files changed

+77
-3
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,20 @@ commit_filter:
287287
usually create. See also <code>out params.refs_prefix</code>.
288288
</td>
289289
</tr>
290+
<tr>
291+
<td><code>debug</code> (Optional)</td>
292+
<td>
293+
Set to <code>true</code> to enable. Sets the following for check/get/put
294+
steps of the resource. Secrets may not be correctly redacted due the
295+
JSON encoding of longer secret strings.
296+
<pre>
297+
set -x
298+
export GIT_TRACE=1
299+
export GIT_TRACE_PACKFILE=1
300+
export GIT_CURL_VERBOSE=1
301+
</pre>
302+
</td>
303+
</tr>
290304
</table>
291305

292306
### Example
@@ -513,6 +527,20 @@ correct key is provided set in `git_crypt_key`.
513527
<code>source.branch</code> or the default branch) will be fetched.
514528
</td>
515529
</tr>
530+
<tr>
531+
<td><code>debug</code> (Optional)</td>
532+
<td>
533+
Set to <code>true</code> to enable. Sets the following for check/get/put
534+
steps of the resource. Secrets may not be correctly redacted due the
535+
JSON encoding of longer secret strings.
536+
<pre>
537+
set -x
538+
export GIT_TRACE=1
539+
export GIT_TRACE_PACKFILE=1
540+
export GIT_CURL_VERBOSE=1
541+
</pre>
542+
</td>
543+
</tr>
516544
</table>
517545

518546
#### GPG signature verification
@@ -654,6 +682,20 @@ and the `rebase` parameter is not provided, the push will fail.
654682
Useful when paired with <code>source.search_remote_refs</code> in cases where the git remote renames the ref you pushed.
655683
</td>
656684
</tr>
685+
<tr>
686+
<td><code>debug</code> (Optional)</td>
687+
<td>
688+
Set to <code>true</code> to enable. Sets the following for check/get/put
689+
steps of the resource. Secrets may not be correctly redacted due the
690+
JSON encoding of longer secret strings.
691+
<pre>
692+
set -x
693+
export GIT_TRACE=1
694+
export GIT_TRACE_PACKFILE=1
695+
export GIT_CURL_VERBOSE=1
696+
</pre>
697+
</td>
698+
</tr>
657699
</table>
658700

659701
## Development

assets/check

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ if jq --exit-status 'length > 0' <<< "$unknown_keys" &>/dev/null; then
2121
exit 1
2222
fi
2323

24+
debug=$(jq -r '.source.debug // false' <<< "$payload")
25+
if [[ "$debug" == "true" ]]; then
26+
echo "debug mode enabled"
27+
set -x
28+
export GIT_TRACE=1
29+
export GIT_TRACE_PACKFILE=1
30+
export GIT_CURL_VERBOSE=1
31+
fi
32+
2433
load_pubkey "$payload"
2534
configure_https_tunnel "$payload"
2635
configure_git_ssl_verification "$payload"

assets/in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ if jq --exit-status 'length > 0' <<< "$unknown_keys" &>/dev/null; then
3333
exit 1
3434
fi
3535

36+
src_debug=$(jq -r '.source.debug // false' <<< "$payload")
37+
params_debug=$(jq -r '.params.debug // false' <<< "$payload")
38+
if [[ "$src_debug" == "true" || "$params_debug" == "true" ]]; then
39+
echo "debug mode enabled"
40+
set -x
41+
export GIT_TRACE=1
42+
export GIT_TRACE_PACKFILE=1
43+
export GIT_CURL_VERBOSE=1
44+
fi
45+
3646
load_pubkey "$payload"
3747
load_git_crypt_key "$payload"
3848
configure_https_tunnel "$payload"

assets/in_schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
"short_ref_format": "",
1111
"timestamp_format": "",
1212
"describe_ref_options": "",
13-
"all_branches": ""
13+
"all_branches": "",
14+
"debug": ""
1415
}

assets/out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ if jq --exit-status 'length > 0' <<< "$unknown_keys" &>/dev/null; then
2828
exit 1
2929
fi
3030

31+
src_debug=$(jq -r '.source.debug // false' <<< "$payload")
32+
params_debug=$(jq -r '.params.debug // false' <<< "$payload")
33+
if [[ "$src_debug" == "true" || "$params_debug" == "true" ]]; then
34+
echo "debug mode enabled"
35+
set -x
36+
export GIT_TRACE=1
37+
export GIT_TRACE_PACKFILE=1
38+
export GIT_CURL_VERBOSE=1
39+
fi
40+
3141
load_pubkey "$payload"
3242
configure_https_tunnel "$payload"
3343
configure_git_ssl_verification "$payload"

assets/out_schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"annotate": "",
1313
"notes": "",
1414
"branch": "",
15-
"refs_prefix": ""
15+
"refs_prefix": "",
16+
"debug": ""
1617
}

assets/source_schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"https_tunnel": "",
2626
"commit_filter": "",
2727
"version_depth": "",
28-
"search_remote_refs": ""
28+
"search_remote_refs": "",
29+
"debug": ""
2930
}

0 commit comments

Comments
 (0)