Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit ec20d5e

Browse files
Merge pull request jenkinsci#688 from oleg-nenashev/feature/debug-flag
Simplify debugging of Jenkins master within Docker images
2 parents 1b818c9 + c189c86 commit ec20d5e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ Tests are written using [bats](https://github.com/sstephenson/bats) under the `t
257257

258258
Bats can be easily installed with `brew install bats` on OS X
259259

260+
# Debugging
261+
262+
In order to debug the master, use the `-e DEBUG=true -p 5005:5005` when starting the container.
263+
Jenkins will be suspended on the startup in such case,
264+
and then it will be possible to attach a debugger from IDE to it.
265+
260266
# Questions?
261267

262268
Jump on irc.freenode.net and the #jenkins room. Ask!

jenkins.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
1515
java_opts_array+=( "$item" )
1616
done < <([[ $JAVA_OPTS ]] && xargs printf '%s\0' <<<"$JAVA_OPTS")
1717

18+
if [[ "$DEBUG" ]] ; then
19+
java_opts_array+=( \
20+
'-Xdebug' \
21+
'-Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y' \
22+
)
23+
fi
24+
1825
jenkins_opts_array=( )
1926
while IFS= read -r -d '' item; do
2027
jenkins_opts_array+=( "$item" )

0 commit comments

Comments
 (0)