From 07fcf25b13026588c81cccc275d07feeed4f048c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Hedenstr=C3=B6m?= <erik@codemate.se>
Date: Mon, 17 Mar 2014 21:07:45 +0100
Subject: [PATCH] Revert "Made starting swarm client optional"

This reverts commit 5d01be9d1e1022c0819985cf6120785d0baf2e1e.
---
 Dockerfile |  3 +--
 init.sh    | 22 ++++++++++------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 49e71ee..1e3582e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,12 +26,11 @@ RUN mkdir -p /var/run/sshd
 ENV JENKINS_HOME /var/lib/jenkins
 ADD init.sh /init.sh
 ADD install /tmp/install
-RUN for INSTALLER in `ls /tmp/install/*.sh | sort -n`; do /bin/bash $INSTALLER; done && rm -rf /tmp/install
+RUN for INSTALLER in `ls /tmp/install/0*.sh | sort -n`; do /bin/bash $INSTALLER; done && rm -rf /tmp/install
 
 # Start Jenkins Slave
 ENV SWARM_USER jenkins
 ENV SWARM_PASSWORD pC4oLhceTFo4fzzVugzZ
-ENV SWARM_EXECUTORS 1
 EXPOSE 22
 VOLUME ["/var/lib/jenkins"]
 CMD ["/bin/bash", "/init.sh"]
\ No newline at end of file
diff --git a/init.sh b/init.sh
index b8091dd..2348671 100644
--- a/init.sh
+++ b/init.sh
@@ -2,15 +2,13 @@
 
 set -e # Exit on errors
 
-if [ ${SWARM_MASTER:+x} ]; then
-    echo "-> Starting SSH Daemon & Swarm Client ..."
-    echo "   - SWARM_MASTER:    $SWARM_MASTER"
-    echo "   - SWARM_USER:      $SWARM_USER"
-    echo "   - SWARM_PASSWORD:  $SWARM_PASSWORD"
-    echo "   - SWARM_EXECUTORS: $SWARM_EXECUTORS"
-    /usr/sbin/sshd
-    su -l $JENKINS_USER --shell=/bin/bash -c "java -jar /var/lib/jenkins/tools/swarm/swarm-client.jar -executors $SWARM_EXECUTORS -master $SWARM_MASTER -username $SWARM_USER -password $SWARM_PASSWORD"
-else
-    echo "-> Starting SSH Daemon ..."
-    /usr/sbin/sshd -e -D
-fi
+# Check if required parameters are set
+: ${SWARM_MASTER:?"Please use 'docker run -e SWARM_MASTER=...' to run this container!"}
+
+echo "-> Starting Jenkins Slave ..."
+echo "   - SWARM_MASTER:   $SWARM_MASTER"
+echo "   - SWARM_USER:     $SWARM_USER"
+echo "   - SWARM_PASSWORD: $SWARM_PASSWORD"
+
+/usr/sbin/sshd
+su -l $JENKINS_USER --shell=/bin/bash -c "java -jar /var/lib/jenkins/tools/swarm/swarm-client.jar -master $SWARM_MASTER -username $SWARM_USER -password $SWARM_PASSWORD"
-- 
GitLab