[SCM] jenkins packaging branch, master, updated. upstream/1.409.3-7-gfd51978
James Page
james.page at canonical.com
Fri Dec 9 13:06:05 UTC 2011
The following commit has been merged in the master branch:
commit 34dce07aaf167d83cbc42e551725eba37be29144
Author: James Page <james.page at canonical.com>
Date: Fri Dec 9 10:13:01 2011 +0000
Added tradditional Debian init scripts and default configuration for jenkins and jenkins-slave packages and updated rules to switch in upstart configuration for Ubuntu builds.
diff --git a/debian/changelog b/debian/changelog
index d8478b9..5b5cc5e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,10 +3,11 @@ jenkins (1.409.3-1) unstable; urgency=low
* Initial Debian release (Closes: #561963)
* Disabled build of libjenkins-plugin-parent-java as not currently
installable due to broken upstream maven-hpi-plugin.
- * Added tradditional Debian init scripts for jenkins and jenkins-slave
- and updated rules to switch in upstart configuration for Ubuntu builds.
+ * Added tradditional Debian init scripts and default configuration for jenkins
+ and jenkins-slave packages and updated rules to switch in upstart
+ configuration for Ubuntu builds.
- -- James Page <james.page at ubuntu.com> Fri, 09 Dec 2011 09:44:05 +0000
+ -- James Page <james.page at ubuntu.com> Fri, 09 Dec 2011 10:11:39 +0000
jenkins (1.409.3-0ubuntu1) precise; urgency=low
diff --git a/debian/jenkins.default b/debian/jenkins-slave.default
similarity index 54%
copy from debian/jenkins.default
copy to debian/jenkins-slave.default
index 77be80c..d01bfb8 100644
--- a/debian/jenkins.default
+++ b/debian/jenkins-slave.default
@@ -1,15 +1,17 @@
-# defaults for jenkins continuous integration server
+# defaults for jenkins-slave component of the jenkins continuous integration
+# system
# pulled in from the init script; makes things easier.
-NAME=jenkins
+NAME=jenkins-slave
# location of java
JAVA=/usr/bin/java
-# arguments to pass to java
+# arguments to pass to java - optional
#JAVA_ARGS="-Xmx256m"
-PIDFILE=/var/run/jenkins/jenkins.pid
+# for daemon to use
+PIDFILE=/var/run/jenkins/$NAME.pid
# user id to be invoked as (otherwise will run as root; not wise!)
JENKINS_USER=jenkins
@@ -17,9 +19,6 @@ JENKINS_USER=jenkins
# location of jenkins arch indep files
JENKINS_ROOT=/usr/share/jenkins
-# location of the jenkins war file
-JENKINS_WAR=/usr/share/jenkins/jenkins.war
-
# jenkins home location
JENKINS_HOME=/var/lib/jenkins
@@ -31,28 +30,27 @@ JENKINS_RUN=/var/run/jenkins
# to host jenkins.
RUN_STANDALONE=true
+# URL of jenkins server to connect to
+# Not specifying this parameter will stop the slave
+# job from running.
+#JENKINS_URL=""
+
+# Name of slave configuration to use at JENKINS_URL
+# Override if it need to be something other than the
+# hostname of the server the slave is running on.
+JENKINS_HOSTNAME="$(hostname)"
+
# log location. this may be a syslog facility.priority
-JENKINS_LOG=/var/log/jenkins/$NAME.log
+JENKINS_SLAVE_LOG=/var/log/jenkins/$NAME.log
# OS LIMITS SETUP
# comment this out to observe /etc/security/limits.conf
# this is on by default because http://github.com/feniix/hudson/commit/d13c08ea8f5a3fa730ba174305e6429b74853927
# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
-# descriptors are forced to 1024 regardless of /etc/security/limits.conf
+# descriptors are forced to 1024 regardless of /etc/security/limits.confa
+# NOTE - Ubuntu Users - this is not used by the upstart configuration - please use an upstart overrides file
+# to change the OS limits setup.
MAXOPENFILES=8192
-# port for HTTP connector (default 8080; disable with -1)
-HTTP_PORT=8080
-
-# port for AJP connector (disabled by default)
-AJP_PORT=-1
-
-# arguments to pass to jenkins.
-# --javahome=$JAVA_HOME
-# --httpPort=$HTTP_PORT (default 8080; disable with -1)
-# --httpsPort=$HTTP_PORT
-# --ajp13Port=$AJP_PORT
-# --argumentsRealm.passwd.$ADMIN_USER=[password]
-# --argumentsRealm.$ADMIN_USER=admin
-# --webroot=~/.jenkins/war
-JENKINS_ARGS="--webroot=$JENKINS_RUN/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --preferredClassLoader=java.net.URLClassLoader"
+# Arguments to pass to jenkins slave on startup
+JENKINS_ARGS="-jnlpUrl $JENKINS_URL/computer/$JENKINS_HOSTNAME/slave-agent.jnlp"
diff --git a/debian/jenkins.init b/debian/jenkins-slave.init
similarity index 81%
copy from debian/jenkins.init
copy to debian/jenkins-slave.init
index ad24932..fe1dcf6 100644
--- a/debian/jenkins.init
+++ b/debian/jenkins-slave.init
@@ -1,29 +1,32 @@
#!/bin/bash
-# /etc/init.d/jenkins
-# debian-compatible jenkins startup script.
-# Amelia A Lewis <alewis at ibco.com>
+# /etc/init.d/jenkins-slave
+# debian-compatible jenkins-slave startup script.
+# Based on work by Amelia A Lewis <alewis at ibco.com>
#
### BEGIN INIT INFO
-# Provides: jenkins
+# Provides: jenkins-slave
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
-# Short-Description: Start jenkins at boot time
-# Description: Controls the jenkins continuous integration engine.
+# Short-Description: Start jenkins-slave at boot time
+# Description: Controls the jenkins slave.
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
-DESC="Jenkins Continuous Integration Server"
-NAME=jenkins
+DESC="Jenkins Slave"
+NAME=jenkins-slave
SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-#DAEMON=$JENKINS_SH
+# Only run this daemon if JENKINS url is specified.
+# in defaults
+[ -n "$JENKINS_URL" ] || exit 0
+
DAEMON=/usr/bin/daemon
-DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=$JENKINS_HOME --output=$JENKINS_LOG --pidfile=$PIDFILE"
+DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=$JENKINS_HOME --output=$JENKINS_SLAVE_LOG --pidfile=$PIDFILE"
SU=/bin/su
@@ -56,27 +59,6 @@ if [ `id -u` -ne 0 ]; then
exit 1
fi
-
-check_tcp_port() {
- local service=$1
- local assigned=$2
- local default=$3
-
- if [ -n "$assigned" ]; then
- port=$assigned
- else
- port=$default
- fi
-
- count=`netstat --listen --numeric-ports | grep \:$port[[:space:]] | grep -c . `
-
- if [ $count -ne 0 ]; then
- echo "The selected $service port ($port) seems to be in use by another program "
- echo "Please select another port to use for $NAME"
- return 1
- fi
-}
-
#
# Function that starts the daemon/service
#
@@ -90,10 +72,6 @@ do_start()
# 1 if daemon was already running
# 2 if daemon could not be started
$DAEMON $DAEMON_ARGS --running && return 1
-
- # Verify that the jenkins port is not already in use, winstone does not exit
- # even for BindException
- check_tcp_port "http" "$HTTP_PORT" "8080" || return 1
# If the var MAXOPENFILES is enabled in /etc/default/jenkins then set the max open files to the
# proper value
@@ -101,10 +79,13 @@ do_start()
[ "$VERBOSE" != no ] && echo Setting up max open files limit to $MAXOPENFILES
ulimit -n $MAXOPENFILES
fi
+
+ # Ensure that slave.jar has been downloaded from JENKINS_URL
+ $JENKINS_ROOT/bin/download-slave.sh
# --user in daemon doesn't prepare environment variables like HOME, USER, LOGNAME or USERNAME,
# so we let su do so for us now
- $SU -l $JENKINS_USER --shell=/bin/bash -c "$DAEMON $DAEMON_ARGS -- $JAVA $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS" || return 2
+ $SU -l $JENKINS_USER --shell=/bin/bash -c "$DAEMON $DAEMON_ARGS -- $JAVA $JAVA_ARGS -jar $JENKINS_RUN/slave.jar $JENKINS_ARGS" || return 2
}
diff --git a/debian/jenkins-slave.upstart b/debian/jenkins-slave.upstart
deleted file mode 100644
index e15483c..0000000
--- a/debian/jenkins-slave.upstart
+++ /dev/null
@@ -1,38 +0,0 @@
-description "jenkins: Jenkins Slave Agent"
-author "James Page <james.page at canonical.com>"
-
-start on (local-filesystems and net-device-up IFACE!=lo)
-stop on runlevel [!2345]
-
-env USER="jenkins"
-env GROUP="jenkins"
-env JENKINS_LOG="/var/log/jenkins"
-env JENKINS_HOME="/var/lib/jenkins"
-env JENKINS_ROOT="/usr/share/jenkins"
-env JENKINS_RUN="/var/run/jenkins"
-# Override this env variable if this host is configured
-# in Jenkins with anything other than its hostname
-env JENKINS_HOSTNAME=""
-# Override this env variable to point to jenkins install
-# By default this is empty so slave will not start
-env JENKINS_URL=""
-env JAVA_OPTS=""
-env JAVA_HOME="/usr/lib/jvm/default-java"
-
-pre-start script
- if [ ! -n "$JENKINS_URL" ]; then
- stop; exit 0
- fi
- mkdir $JENKINS_RUN > /dev/null 2>&1 || true
- $JENKINS_ROOT/bin/download-slave.sh
- chown -R $USER:$GROUP $JENKINS_RUN || true
-end script
-
-script
- if [ ! -n "$JENKINS_HOSTNAME" ]; then
- JENKINS_HOSTNAME=$(hostname)
- fi
- exec daemon --name=jenkins-slave --inherit --output=$JENKINS_LOG/jenkins-slave.log --user=$USER \
- -- $JAVA_HOME/bin/java $JAVA_OPTS -jar $JENKINS_RUN/slave.jar \
- -jnlpUrl $JENKINS_URL/computer/$JENKINS_HOSTNAME/slave-agent.jnlp
-end script
diff --git a/debian/jenkins-slave.upstart.in b/debian/jenkins-slave.upstart.in
new file mode 100644
index 0000000..997ac57
--- /dev/null
+++ b/debian/jenkins-slave.upstart.in
@@ -0,0 +1,20 @@
+description "jenkins: Jenkins Slave Agent"
+author "James Page <james.page at ubuntu.com>"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+pre-start script
+ [ -r /etc/default/jenkins-slave.default ] && . /etc/default/jenkins-slave
+ [ -n "$JENKINS_URL" ] || { stop; exit 0 }
+ $JENKINS_ROOT/bin/download-slave.sh
+ mkdir $JENKINS_RUN > /dev/null 2>&1 || true
+ chown -R $JENKINS_USER $JENKINS_RUN || true
+end script
+
+script
+ [ -r /etc/default/jenkins-slave.default ] && . /etc/default/jenkins-slave
+ exec su -l $JENKINS_USER --shell=/bin/bash -c \
+ "daemon --name=$NAME --inherit --output=$JENKINS_SLAVE_LOG \
+ -- $JAVA $JAVA_ARGS -jar $JENKINS_RUN/slave.jar $JENKINS_ARGS"
+end script
diff --git a/debian/rules b/debian/rules
index 5d33c60..875e4ba 100755
--- a/debian/rules
+++ b/debian/rules
@@ -34,6 +34,11 @@ binary-post-install/jenkins::
cp debian/jenkins.upstart.in debian/jenkins.upstart ; \
fi
+binary-post-install/jenkins-slave::
+ if dpkg-vendor --derives-from ubuntu ; then \
+ cp debian/jenkins-slave.upstart.in debian/jenkins-slave.upstart ; \
+ fi
+
# Tidy up any upstart configuration files lying around
clean::
rm -rf debian/*.upstart
--
jenkins packaging
More information about the pkg-java-commits
mailing list