Last active
March 28, 2019 19:57
-
-
Save ludat/ef6533bcd62203730013ac842d258511 to your computer and use it in GitHub Desktop.
Jenkins hack
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 | |
# Copy files from /usr/share/jenkins/ref into /var/jenkins_home | |
# So the initial JENKINS-HOME is set with expected content. | |
# Don't override, as this is just a reference setup, and use from UI | |
# can then change this, upgrade plugins, etc. | |
copy_reference_file() { | |
f=${1%/} | |
echo "$f" | |
rel=${f:23} | |
dir=$(dirname ${f}) | |
echo " $f -> $rel" | |
if [[ ! -e /var/jenkins_home/${rel} ]] | |
then | |
echo "copy $rel to JENKINS_HOME" | |
mkdir -p /var/jenkins_home/${dir:23} | |
cp -r /usr/share/jenkins/ref/${rel} /var/jenkins_home/${rel}; | |
fi; | |
} | |
export -f copy_reference_file | |
find /usr/share/jenkins/ref/ -type f -exec bash -c 'copy_reference_file {}' \; | |
# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments | |
if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then | |
exec java $JAVA_OPTS -Dhttps.protocols=TLSv1.2 -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@" | |
fi | |
# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image | |
# exec "$@" | |
exec java -Dhttps.procotols=TLSv1.2 -jar /var/jenkins_home/jenkins.war |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment