Skip to content

Commit

Permalink
Do not run debug by default
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed Jul 23, 2017
1 parent 989ed09 commit ff86320
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Expand Up @@ -65,7 +65,7 @@ docker build -t onenashev/demo-jenkins-config-as-code .
Run image:

```shell
docker run --rm --name ci-jenkins-io-dev -v maven-repo:/root/.m2 -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 -p 5005:5005 onenashev/demo-jenkins-config-as-code
docker run --rm --name ci-jenkins-io-dev -v maven-repo:/root/.m2 -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 onenashev/demo-jenkins-config-as-code
```

Jenkins will need to connect to the Docker host to run agents.
Expand All @@ -81,8 +81,13 @@ In the _Development_ folder there is a _PipelineLib_ folder, which allows local
This folder can be mapped to a local repository in order to develop the library without committing changes:

```shell
docker run --rm --name ci-jenkins-io-dev -v maven-repo:/root/.m2 -v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 -p 5005:5005 onenashev/demo-jenkins-config-as-code
docker run --rm --name ci-jenkins-io-dev -v maven-repo:/root/.m2 -v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 onenashev/demo-jenkins-config-as-code
```

Once started, you can just start editing the Pipeline library locally.
On every job start the changes will be reflected in the directory without committing anything.

##### Debugging Master

In order to debug the master, use the `-e DEBUG=true -p 5005:5005` when starting the container.
Jenkins will be suspended on the startup in such case.
9 changes: 7 additions & 2 deletions jenkins2.sh
Expand Up @@ -6,8 +6,6 @@ extra_java_opts=( \
'-Djenkins.model.Jenkins.slaveAgentPortEnforce=true' \
"-Dio.jenkins.dev.security.createAdmin=${CONF_CREATE_ADMIN}" \
"-Dio.jenkins.dev.security.allowRunsOnMaster=${CONF_ALLOW_RUNS_ON_MASTER}" \
'-Xdebug' \
'-Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=n' \
'-Dhudson.model.LoadStatistics.clock=1000' \
)

Expand All @@ -17,5 +15,12 @@ else
extra_java_opts+=( "-Dio.jenkins.dev.host=${DEV_HOST}" )
fi

if [[ "$DEBUG" ]] ; then
extra_java_opts+=( \
'-Xdebug' \
'-Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y' \
)
fi

export JAVA_OPTS="$JAVA_OPTS ${extra_java_opts[@]}"
exec /usr/local/bin/jenkins.sh "$@"

0 comments on commit ff86320

Please sign in to comment.