Created
August 2, 2017 14:56
-
-
Save sfrehse/02c7d57fad862c71c20f07c59caba240 to your computer and use it in GitHub Desktop.
Jenkins slave startup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# if `docker run` first argument start with `-` the user is passing jenkins swarm launcher arguments | |
if [[ $# -lt 1 ]] || [[ "$1" == "-"* ]]; then | |
# jenkins swarm slave | |
JAR=`ls -1 /usr/share/jenkins/swarm-client-*.jar | tail -n 1` | |
# if -master is not provided and using --link jenkins:jenkins | |
if [[ "$@" != *"-master "* ]] && [ ! -z "$JENKINS_PORT_8080_TCP_ADDR" ]; then | |
PARAMS="-master http://$JENKINS_PORT_8080_TCP_ADDR:$JENKINS_PORT_8080_TCP_PORT" | |
fi | |
echo Running java $JAVA_OPTS -jar $JAR -fsroot $HOME $PARAMS "$@" | |
exec java $JAVA_OPTS -jar $JAR -fsroot $HOME $PARAMS "$@" | |
fi | |
# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment