Skip to content
Commits on Source (6)
......@@ -105,7 +105,9 @@ Process to follow to add a new node to jenkins:
* 'Usage': select "Only build jobs with label expressions matching this node"
* 'Launch method': select "Launch agent via execution of command on the master"
* 'Launch command': `/srv/jenkins/bin/start-slave.sh`
* 'Availability': select "Keep this agent online as much as possible"
* 'Availability': select "Take this agent online when in demand, and offline when idle"
* 'In demand delay': 0 (so that builds will start right away)
* 'Idle delay': 5 (this is an arbitrary amount of time)
The slave setup is done so that the slave.jar program doesn't get run on the remote nodes,
to avoid needing Java available in there.
......
......@@ -57,6 +57,15 @@ while true ; do
echo "The lockfile $LOCKFILE is present, thus stopping this"
break
fi
JENKINS_OFFLINE_LIST="/var/lib/jenkins/offline_nodes"
if [ -f "$JENKINS_OFFLINE_LIST" ]; then
for n in "$NODE1" "$NODE2"; do
if grep -q "$n" "$JENKINS_OFFLINE_LIST"; then
echo "$n is currently marked as offline, stopping the worker."
break
fi
done
fi
# sleep up to 2.3 seconds (additionally to the random sleep reproducible_build.sh does anyway)
/bin/sleep $(echo "scale=1 ; $(shuf -i 1-23 -n 1)/10" | bc )
......
#!/bin/bash
#!/bin/sh
# slave.jar has to be downloaded from http://localhost/jnlpJars/slave.jar
# There doesn't seem to be any better way to figure out the slave name
# from here, let's just hope all WORKSPACE have been set correctly
NODE_NAME="$(basename ${WORKSPACE})"
echo "Starting slave.jar for $NODE_NAME}..."
f="/var/lib/jenkins/offline_nodes"
if [ -f "$f" ]; then
if grep -q "$NODE_NAME" "$f"; then
echo "This node is currently marked as offline, not starting slave.jar"
exit 1
fi
fi
echo "This jenkins slave.jar will run as PID $$."
exec java -jar /var/lib/jenkins/slave.jar
# The hosts listed below are known to be down atm.
# No builds will be dispatched to those nodes, and the nodes will be marked
# as offline in the jenkins UI.
ff2a-armhf-rb.debian.net
......@@ -597,16 +597,14 @@ else
fi
sudo mkdir -p /var/lib/jenkins/.ssh
sudo mkdir -m 700 /var/lib/jenkins/.ssh
if [ "$HOSTNAME" = "jenkins" ] ; then
sudo cp jenkins-home/procmailrc /var/lib/jenkins/.procmailrc
sudo cp jenkins-home/authorized_keys /var/lib/jenkins/.ssh/authorized_keys
sudo -u jenkins install -m 600 jenkins-home/authorized_keys /var/lib/jenkins/.ssh/authorized_keys
sudo -u jenkins cp jenkins-home/procmailrc /var/lib/jenkins/.procmailrc
sudo -u jenkins cp jenkins-home/offline_nodes /var/lib/jenkins/offline_nodes
else
sudo cp jenkins-nodes-home/authorized_keys /var/lib/jenkins/.ssh/authorized_keys
fi
sudo chown -R jenkins:jenkins /var/lib/jenkins/.ssh
sudo chmod 700 /var/lib/jenkins/.ssh
sudo chmod 600 /var/lib/jenkins/.ssh/authorized_keys
explain "scripts and configurations for jenkins updated."
if [ "$HOSTNAME" = "jenkins" ] ; then
......