-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins-slave
executable file
·42 lines (33 loc) · 1.24 KB
/
jenkins-slave
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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# Usage jenkins-slave.sh [options] -url http://jenkins SECRET SLAVE_NAME
# Optional environment variables :
# * JENKINS_TUNNEL : HOST:PORT for a tunnel to route TCP traffic to jenkins host, when jenkins can't be directly accessed over network
# * JENKINS_URL : alternate jenkins URL
# except a secret and a slave name to be passed in e.g.
# ad15e596a0cc2628d7f8d77c09c2498770cd670ad2261b631eddb3dc0936e8da docker-slave-8a9212d4babe
echo '------args passed to jenkins slave--------'
echo $@
echo '-----end args passed to jenkins slave-----'
echo 'env:'
echo `env | sort`
echo '------------------------------------------'
echo "JENKINS_TUNNEL=$JENKINS_TUNNEL"
echo "JENKINS_URL=$JENKINS_URL"
set -e
if [[ ! -z "$JENKINS_URL" ]]; then
URL="-url $JENKINS_URL"
else
echo 'Required environment variable [JENKINS_URL] not specified'
exit 1
fi
if [[ ! -z "$JENKINS_TUNNEL" ]]; then
TUNNEL="-tunnel $JENKINS_TUNNEL"
else
echo 'environment variable [JENKINS_TUNNEL] not specified, will default to [$JENKINS_URL:50000]'
fi
echo "JENKINS_TUNNEL=$JENKINS_TUNNEL"
echo "JENKINS_URL=$JENKINS_URL"
echo "TUNNEL=$TUNNEL"
echo "URL=$URL"
set -x
java $JAVA_OPTS -cp /usr/share/jenkins/slave.jar hudson.remoting.jnlp.Main -headless $TUNNEL $URL "$@"