Skip to content

Commit 4dc8f82

Browse files
committed
Adding persistant JENKINS_HOME support
1 parent 3872da1 commit 4dc8f82

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

mesos/jenkins/connect-slave.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
curl -sSL -XPOST -H "Content-Type: application/json" -d @- "http://marathon.mesos:8080/v2/apps" <<END
33
{
4-
"id": "/jenkins/build/$3",
4+
"id": "/jenkins/slaves/$3",
55
"cpus": 1,
66
"mem": 8192,
77
"instances": 1,

mesos/jenkins/jenkins.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,27 @@ copy_reference_file() {
2525
: ${JENKINS_HOME:="/var/jenkins_home"}
2626
export -f copy_reference_file
2727
touch "${COPY_REFERENCE_FILE_LOG}" || (echo "Can not write to ${COPY_REFERENCE_FILE_LOG}. Wrong volume permissions?" && exit 1)
28-
echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
29-
find /usr/share/jenkins/ref/ -type f -exec bash -c "copy_reference_file '{}'" \;
3028

31-
sed -i "s#\${JENKINS_CONFIG_REPO}#$JENKINS_CONFIG_REPO#g" $JENKINS_HOME/scm-sync-configuration.xml
32-
cp -R $MESOS_SANDBOX/.ssh $JENKINS_HOME/.ssh
29+
if [ "x$USE_PERSISTANT_JENKINS_HOME" == "x" ]; then
30+
rm -f $JENKINS_HOME/.USE_PERSISTANT_JENKINS_HOME
31+
echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
32+
find /usr/share/jenkins/ref/ -type f -exec bash -c "copy_reference_file '{}'" \;
33+
sed -i "s#\${JENKINS_CONFIG_REPO}#$JENKINS_CONFIG_REPO#g" $JENKINS_HOME/scm-sync-configuration.xml
34+
cp -R $MESOS_SANDBOX/.ssh $JENKINS_HOME/.ssh
35+
else
36+
if [ ! -f $JENKINS_HOME/.USE_PERSISTANT_JENKINS_HOME ]; then
37+
echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
38+
find /usr/share/jenkins/ref/ -type f -exec bash -c "copy_reference_file '{}'" \;
39+
sed -i "s#\${JENKINS_CONFIG_REPO}#$JENKINS_CONFIG_REPO#g" $JENKINS_HOME/scm-sync-configuration.xml
40+
cp -R $MESOS_SANDBOX/.ssh $JENKINS_HOME/.ssh
41+
touch $JENKINS_HOME/.USE_PERSISTANT_JENKINS_HOME
42+
fi
43+
fi
3344

3445
# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
3546
if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
3647
eval "exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS \"\$@\""
37-
fi
38-
48+
else
3949
# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image
40-
exec "$@"
50+
exec "$@"
51+
fi

0 commit comments

Comments
 (0)