forked from rancher/jenkins-slave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.sh
31 lines (28 loc) · 790 Bytes
/
cmd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# jenkins swarm slave
JAR=`ls -1 $HOME/swarm-client-*.jar | tail -n 1`
PARAMS=""
if [ ! -z "$JENKINS_USERNAME" ]; then
PARAMS="$PARAMS -username $JENKINS_USERNAME"
fi
if [ ! -z "$JENKINS_PASSWORD" ]; then
PARAMS="$PARAMS -password $JENKINS_PASSWORD"
fi
if [ ! -z "$SLAVE_EXECUTORS" ]; then
PARAMS="$PARAMS -executors $SLAVE_EXECUTORS"
fi
if [ ! -z "$SLAVE_LABELS" ]; then
PARAMS="$PARAMS -labels $SLAVE_LABELS"
fi
if [ ! -z "$SLAVE_NAME" ]; then
PARAMS="$PARAMS -name $SLAVE_NAME"
fi
if [ ! -z "$JENKINS_MASTER" ]; then
PARAMS="$PARAMS -master $JENKINS_MASTER"
else
if [ ! -z "$JENKINS_SERVICE_PORT" ]; then
# kubernetes environment variable
PARAMS="$PARAMS -master http://$SERVICE_HOST:$JENKINS_SERVICE_PORT"
fi
fi
java -jar $JAR $PARAMS -fsroot $HOME