@@ -25,16 +25,30 @@ copy_reference_file() {
25
25
: ${JENKINS_HOME:= " /var/jenkins_home" }
26
26
export -f copy_reference_file
27
27
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 '{}'" \;
30
28
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
44
+ if [ [ ! -f $JENKINS_HOME /.gitconfig ] -a [ -f $JENKINS_HOME /gitconfig ] ]; then
45
+ mv -f $JENKINS_HOME /gitconfig $JENKINS_HOME /.gitconfig
46
+ fi
33
47
34
48
# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
35
49
if [[ $# -lt 1 ]] || [[ " $1 " == " --" * ]]; then
36
50
eval " exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS \"\$ @\" "
37
- fi
38
-
51
+ else
39
52
# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image
40
- exec " $@ "
53
+ exec " $@ "
54
+ fi
0 commit comments