-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jenkins fix 2.19.1 and 2.7.4 tags #2228
Conversation
Not really the most helpful diff, since it is just the reverse of the last PR. diff --git a/jenkins_2.7.4-alpine/Dockerfile b/jenkins_2.19.1-alpine/Dockerfile
similarity index 100%
copy from jenkins_2.7.4-alpine/Dockerfile
copy to jenkins_2.19.1-alpine/Dockerfile
diff --git a/jenkins_2.7.4/init.groovy b/jenkins_2.19.1-alpine/init.groovy
similarity index 100%
copy from jenkins_2.7.4/init.groovy
copy to jenkins_2.19.1-alpine/init.groovy
diff --git a/jenkins_2.7.4/install-plugins.sh b/jenkins_2.19.1-alpine/install-plugins.sh
similarity index 100%
copy from jenkins_2.7.4/install-plugins.sh
copy to jenkins_2.19.1-alpine/install-plugins.sh
diff --git a/jenkins_2.7.4/jenkins-support b/jenkins_2.19.1-alpine/jenkins-support
similarity index 100%
copy from jenkins_2.7.4/jenkins-support
copy to jenkins_2.19.1-alpine/jenkins-support
diff --git a/jenkins_2.7.4/jenkins.sh b/jenkins_2.19.1-alpine/jenkins.sh
similarity index 100%
copy from jenkins_2.7.4/jenkins.sh
copy to jenkins_2.19.1-alpine/jenkins.sh
diff --git a/jenkins_2.7.4/plugins.sh b/jenkins_2.19.1-alpine/plugins.sh
similarity index 100%
copy from jenkins_2.7.4/plugins.sh
copy to jenkins_2.19.1-alpine/plugins.sh
diff --git a/jenkins_2.7.4/Dockerfile b/jenkins_2.19.1/Dockerfile
similarity index 100%
copy from jenkins_2.7.4/Dockerfile
copy to jenkins_2.19.1/Dockerfile
diff --git a/jenkins_2.7.4/init.groovy b/jenkins_2.19.1/init.groovy
similarity index 100%
copy from jenkins_2.7.4/init.groovy
copy to jenkins_2.19.1/init.groovy
diff --git a/jenkins_2.7.4/install-plugins.sh b/jenkins_2.19.1/install-plugins.sh
similarity index 100%
copy from jenkins_2.7.4/install-plugins.sh
copy to jenkins_2.19.1/install-plugins.sh
diff --git a/jenkins_2.7.4/jenkins-support b/jenkins_2.19.1/jenkins-support
similarity index 100%
copy from jenkins_2.7.4/jenkins-support
copy to jenkins_2.19.1/jenkins-support
diff --git a/jenkins_2.7.4/jenkins.sh b/jenkins_2.19.1/jenkins.sh
similarity index 100%
copy from jenkins_2.7.4/jenkins.sh
copy to jenkins_2.19.1/jenkins.sh
diff --git a/jenkins_2.7.4/plugins.sh b/jenkins_2.19.1/plugins.sh
similarity index 100%
copy from jenkins_2.7.4/plugins.sh
copy to jenkins_2.19.1/plugins.sh
diff --git a/jenkins_2.7.4-alpine/Dockerfile b/jenkins_2.7.4-alpine/Dockerfile
index 100bb36..3f9e06b 100644
--- a/jenkins_2.7.4-alpine/Dockerfile
+++ b/jenkins_2.7.4-alpine/Dockerfile
@@ -1,6 +1,6 @@
FROM openjdk:8-jdk-alpine
-RUN apk add --no-cache git openssh-client curl unzip bash ttf-dejavu coreutils
+RUN apk add --no-cache git openssh-client curl zip unzip bash ttf-dejavu coreutils
ENV JENKINS_HOME /var/jenkins_home
ENV JENKINS_SLAVE_AGENT_PORT 50000
@@ -36,10 +36,10 @@ COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-
port.groov
# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
-ENV JENKINS_VERSION ${JENKINS_VERSION:-2.19.1}
+ENV JENKINS_VERSION ${JENKINS_VERSION:-2.7.4}
# jenkins.war checksum, download will be validated using it
-ARG JENKINS_SHA=dc28b91e553c1cd42cc30bd75d0f651671e6de0b
+ARG JENKINS_SHA=07a2e3e4ace728fdbcc823f46068d2f8cc3cb97b
# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=http://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKI
NS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
diff --git a/jenkins_2.7.4-alpine/install-plugins.sh b/jenkins_2.7.4-alpine/install-plugin
s.sh
index 233b739..8b8daee 100755
--- a/jenkins_2.7.4-alpine/install-plugins.sh
+++ b/jenkins_2.7.4-alpine/install-plugins.sh
@@ -12,15 +12,15 @@ FAILED="$REF_DIR/failed-plugins.txt"
. /usr/local/bin/jenkins-support
-getLockFile() {
- printf '%s' "$REF_DIR/${1}.lock"
+function getLockFile() {
+ echo -n "$REF_DIR/${1}.lock"
}
-getArchiveFilename() {
- printf '%s' "$REF_DIR/${1}.jpi"
+function getArchiveFilename() {
+ echo -n "$REF_DIR/${1}.jpi"
}
-download() {
+function download() {
local plugin originalPlugin version lock ignoreLockFile
plugin="$1"
version="${2:-latest}"
@@ -50,7 +50,7 @@ download() {
fi
}
-doDownload() {
+function doDownload() {
local plugin version url jpi
plugin="$1"
version="$2"
@@ -67,20 +67,20 @@ doDownload() {
url="$JENKINS_UC_DOWNLOAD/plugins/$plugin/$version/${plugin}.hpi"
echo "Downloading plugin: $plugin from $url"
- curl --connect-timeout ${CURL_CONNECTION_TIMEOUT:-20} --retry ${CURL_RETRY:-5} --retr
y-delay ${CURL_RETRY_DELAY:-0} --retry-max-time ${CURL_RETRY_MAX_TIME:-60} -s -f -L "$url"
-o "$jpi"
+ curl --connect-timeout 5 --retry 5 --retry-delay 0 --retry-max-time 60 -s -f -L "$url
" -o "$jpi"
return $?
}
-checkIntegrity() {
+function checkIntegrity() {
local plugin jpi
plugin="$1"
jpi="$(getArchiveFilename "$plugin")"
- unzip -t -qq "$jpi" >/dev/null
+ zip -T "$jpi" >/dev/null
return $?
}
-resolveDependencies() {
+function resolveDependencies() {
local plugin jpi dependencies
plugin="$1"
jpi="$(getArchiveFilename "$plugin")"
@@ -94,7 +94,7 @@ resolveDependencies() {
echo " > $plugin depends on $dependencies"
- IFS=',' read -r -a array <<< "$dependencies"
+ IFS=',' read -a array <<< "$dependencies"
for d in "${array[@]}"
do
@@ -121,7 +121,7 @@ resolveDependencies() {
wait
}
-bundledPlugins() {
+function bundledPlugins() {
local JENKINS_WAR=/usr/share/jenkins/jenkins.war
if [ -f $JENKINS_WAR ]
then
@@ -143,7 +143,7 @@ bundledPlugins() {
fi
}
-versionFromPlugin() {
+function versionFromPlugin() {
local plugin=$1
if [[ $plugin =~ .*:.* ]]; then
echo "${plugin##*:}"
@@ -153,7 +153,7 @@ versionFromPlugin() {
}
-installedPlugins() {
+function installedPlugins() {
for f in "$REF_DIR"/*.jpi; do
echo "$(basename "$f" | sed -e 's/\.jpi//'):$(get_plugin_version "$f")"
done
@@ -170,10 +170,10 @@ main() {
mkdir "$(getLockFile "${plugin%%:*}")"
done
- echo "Analyzing war..."
+ echo -e "\nAnalyzing war..."
bundledPlugins="$(bundledPlugins)"
- echo "Downloading plugins..."
+ echo -e "\nDownloading plugins..."
for plugin in "$@"; do
version=""
@@ -194,11 +194,11 @@ main() {
installedPlugins
if [[ -f $FAILED ]]; then
- echo "Some plugins failed to download!" "$(<"$FAILED")" >&2
+ echo -e "\nSome plugins failed to download!\n$(<"$FAILED")" >&2
exit 1
fi
- echo "Cleaning up locks"
+ echo -e "\nCleaning up locks"
rm -r "$REF_DIR"/*.lock
}
diff --git a/jenkins_2.7.4-alpine/jenkins.sh b/jenkins_2.7.4-alpine/jenkins.sh
index 6cbe125..df1531d 100755
--- a/jenkins_2.7.4-alpine/jenkins.sh
+++ b/jenkins_2.7.4-alpine/jenkins.sh
@@ -1,25 +1,13 @@
#! /bin/bash -e
-: "${JENKINS_HOME:="/var/jenkins_home"}"
-touch "${COPY_REFERENCE_FILE_LOG}" || { echo "Can not write to ${COPY_REFERENCE_FILE_LOG}
. Wrong volume permissions?"; exit 1; }
+: ${JENKINS_HOME:="/var/jenkins_home"}
+touch "${COPY_REFERENCE_FILE_LOG}" || (echo "Can not write to ${COPY_REFERENCE_FILE_LOG}.
Wrong volume permissions?" && exit 1)
echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
-find /usr/share/jenkins/ref/ -type f -exec bash -c '. /usr/local/bin/jenkins-support; for
arg; do copy_reference_file "$arg"; done' _ {} +
+find /usr/share/jenkins/ref/ -type f -exec bash -c ". /usr/local/bin/jenkins-support; cop
y_reference_file '{}'" \;
# if `docker run` first argument start with `--` the user is passing jenkins launcher arg
uments
if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
-
- # read JAVA_OPTS and JENKINS_OPTS into arrays to avoid need for eval (and associated vu
lnerabilities)
- java_opts_array=()
- while IFS= read -r -d '' item; do
- java_opts_array+=( "$item" )
- done < <([[ $JAVA_OPTS ]] && xargs printf '%s\0' <<<"$JAVA_OPTS")
-
- jenkins_opts_array=( )
- while IFS= read -r -d '' item; do
- jenkins_opts_array+=( "$item" )
- done < <([[ $JENKINS_OPTS ]] && xargs printf '%s\0' <<<"$JENKINS_OPTS")
-
- exec java "${java_opts_array[@]}" -jar /usr/share/jenkins/jenkins.war "${jenkins_opts_a
rray[@]}" "$@"
+ eval "exec java $JAVA_OPTS -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
diff --git a/jenkins_2.7.4-alpine/plugins.sh b/jenkins_2.7.4-alpine/plugins.sh
index 9b08ddb..027c382 100755
--- a/jenkins_2.7.4-alpine/plugins.sh
+++ b/jenkins_2.7.4-alpine/plugins.sh
@@ -31,7 +31,7 @@ USAGE:
exit 1
else
JENKINS_INPUT_JOB_LIST=$1
- if [ ! -f "$JENKINS_INPUT_JOB_LIST" ]
+ if [ ! -f $JENKINS_INPUT_JOB_LIST ]
then
echo "ERROR File not found: $JENKINS_INPUT_JOB_LIST"
exit 1
@@ -40,7 +40,7 @@ fi
# the war includes a # of plugins, to make the build efficient filter out
# the plugins so we dont install 2x - there about 17!
-if [ -d "$JENKINS_HOME" ]
+if [ -d $JENKINS_HOME ]
then
TEMP_ALREADY_INSTALLED=$JENKINS_HOME/preinstalled.plugins.$$.txt
else
@@ -49,31 +49,33 @@ else
fi
JENKINS_PLUGINS_DIR=/var/jenkins_home/plugins
-if [ -d "$JENKINS_PLUGINS_DIR" ]
+if [ -d $JENKINS_PLUGINS_DIR ]
then
echo "Analyzing: $JENKINS_PLUGINS_DIR"
- for i in "$JENKINS_PLUGINS_DIR"/*/; do
- JENKINS_PLUGIN=$(basename "$i")
- JENKINS_PLUGIN_VER=$(egrep -i Plugin-Version "$i/META-INF/MANIFEST.MF"|cut -d: -f
2|sed 's/ //')
+ for i in `ls -pd1 $JENKINS_PLUGINS_DIR/*|egrep '\/$'`
+ do
+ JENKINS_PLUGIN=`basename $i`
+ JENKINS_PLUGIN_VER=`egrep -i Plugin-Version "$i/META-INF/MANIFEST.MF"|cut -d\: -f
2|sed 's/ //'`
echo "$JENKINS_PLUGIN:$JENKINS_PLUGIN_VER"
- done >"$TEMP_ALREADY_INSTALLED"
+ done > $TEMP_ALREADY_INSTALLED
else
JENKINS_WAR=/usr/share/jenkins/jenkins.war
- if [ -f "$JENKINS_WAR" ]
+ if [ -f $JENKINS_WAR ]
then
echo "Analyzing war: $JENKINS_WAR"
TEMP_PLUGIN_DIR=/tmp/plugintemp.$$
- while read -r i <&3; do
- rm -fr "$TEMP_PLUGIN_DIR"
- mkdir -p "$TEMP_PLUGIN_DIR"
- PLUGIN=$(basename "$i"|cut -f1 -d'.')
- (cd "$TEMP_PLUGIN_DIR" || exit; jar xf "$JENKINS_WAR" "$i"; jar xvf "$TEMP_PL
UGIN_DIR/$i" META-INF/MANIFEST.MF >/dev/null 2>&1)
- VER=$(egrep -i Plugin-Version "$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF"|cut -d:
-f2|sed 's/ //')
+ for i in `jar tf $JENKINS_WAR | egrep '[^detached-]plugins.*\..pi' | sort`
+ do
+ rm -fr $TEMP_PLUGIN_DIR
+ mkdir -p $TEMP_PLUGIN_DIR
+ PLUGIN=`basename $i|cut -f1 -d'.'`
+ (cd $TEMP_PLUGIN_DIR;jar xf $JENKINS_WAR "$i";jar xvf $TEMP_PLUGIN_DIR/$i MET
A-INF/MANIFEST.MF >/dev/null 2>&1)
+ VER=`egrep -i Plugin-Version "$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF"|cut -d\:
-f2|sed 's/ //'`
echo "$PLUGIN:$VER"
- done 3< <(jar tf "$JENKINS_WAR" | egrep '[^detached-]plugins.*\..pi' | sort) > "$
TEMP_ALREADY_INSTALLED"
- rm -fr "$TEMP_PLUGIN_DIR"
+ done > $TEMP_ALREADY_INSTALLED
+ rm -fr $TEMP_PLUGIN_DIR
else
- rm -f "$TEMP_ALREADY_INSTALLED"
+ rm -f $TEMP_ALREADY_INSTALLED
echo "ERROR file not found: $JENKINS_WAR"
exit 1
fi
@@ -82,30 +84,30 @@ fi
REF=/usr/share/jenkins/ref/plugins
mkdir -p $REF
COUNT_PLUGINS_INSTALLED=0
-while read -r spec || [ -n "$spec" ]; do
+while read spec || [ -n "$spec" ]; do
plugin=(${spec//:/ });
[[ ${plugin[0]} =~ ^# ]] && continue
- [[ ${plugin[0]} =~ ^[[:space:]]*$ ]] && continue
+ [[ ${plugin[0]} =~ ^\s*$ ]] && continue
[[ -z ${plugin[1]} ]] && plugin[1]="latest"
if [ -z "$JENKINS_UC_DOWNLOAD" ]; then
JENKINS_UC_DOWNLOAD=$JENKINS_UC/download
fi
- if ! grep -q "${plugin[0]}:${plugin[1]}" "$TEMP_ALREADY_INSTALLED"
+ if ! grep -q "${plugin[0]}:${plugin[1]}" $TEMP_ALREADY_INSTALLED
then
echo "Downloading ${plugin[0]}:${plugin[1]}"
- curl --retry 3 --retry-delay 5 -sSL -f "${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0
]}/${plugin[1]}/${plugin[0]}.hpi" -o "$REF/${plugin[0]}.jpi"
- unzip -qqt "$REF/${plugin[0]}.jpi"
- (( COUNT_PLUGINS_INSTALLED += 1 ))
+ curl --retry 3 --retry-delay 5 -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]
}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi
+ unzip -qqt $REF/${plugin[0]}.jpi
+ COUNT_PLUGINS_INSTALLED=`expr $COUNT_PLUGINS_INSTALLED + 1`
else
echo " ... skipping already installed: ${plugin[0]}:${plugin[1]}"
fi
-done < "$JENKINS_INPUT_JOB_LIST"
+done < $JENKINS_INPUT_JOB_LIST
echo "---------------------------------------------------"
-if (( "$COUNT_PLUGINS_INSTALLED" > 0 ))
+if [ $COUNT_PLUGINS_INSTALLED -gt 0 ]
then
echo "INFO: Successfully installed $COUNT_PLUGINS_INSTALLED plugins."
@@ -120,5 +122,5 @@ fi
echo "---------------------------------------------------"
#cleanup
-rm "$TEMP_ALREADY_INSTALLED"
+rm $TEMP_ALREADY_INSTALLED
exit 0
diff --git a/jenkins_2.7.4/Dockerfile b/jenkins_2.7.4/Dockerfile
index 28c4e31..0502845 100644
--- a/jenkins_2.7.4/Dockerfile
+++ b/jenkins_2.7.4/Dockerfile
@@ -1,6 +1,6 @@
FROM openjdk:8-jdk
-RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y git curl zip && rm -rf /var/lib/apt/lists/*
ENV JENKINS_HOME /var/jenkins_home
ENV JENKINS_SLAVE_AGENT_PORT 50000
@@ -36,10 +36,10 @@ COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-
port.groov
# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
-ENV JENKINS_VERSION ${JENKINS_VERSION:-2.19.1}
+ENV JENKINS_VERSION ${JENKINS_VERSION:-2.7.4}
# jenkins.war checksum, download will be validated using it
-ARG JENKINS_SHA=dc28b91e553c1cd42cc30bd75d0f651671e6de0b
+ARG JENKINS_SHA=07a2e3e4ace728fdbcc823f46068d2f8cc3cb97b
# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=http://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKI
NS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
diff --git a/jenkins_2.7.4/install-plugins.sh b/jenkins_2.7.4/install-plugins.sh
index 233b739..8b8daee 100755
--- a/jenkins_2.7.4/install-plugins.sh
+++ b/jenkins_2.7.4/install-plugins.sh
@@ -12,15 +12,15 @@ FAILED="$REF_DIR/failed-plugins.txt"
. /usr/local/bin/jenkins-support
-getLockFile() {
- printf '%s' "$REF_DIR/${1}.lock"
+function getLockFile() {
+ echo -n "$REF_DIR/${1}.lock"
}
-getArchiveFilename() {
- printf '%s' "$REF_DIR/${1}.jpi"
+function getArchiveFilename() {
+ echo -n "$REF_DIR/${1}.jpi"
}
-download() {
+function download() {
local plugin originalPlugin version lock ignoreLockFile
plugin="$1"
version="${2:-latest}"
@@ -50,7 +50,7 @@ download() {
fi
}
-doDownload() {
+function doDownload() {
local plugin version url jpi
plugin="$1"
version="$2"
@@ -67,20 +67,20 @@ doDownload() {
url="$JENKINS_UC_DOWNLOAD/plugins/$plugin/$version/${plugin}.hpi"
echo "Downloading plugin: $plugin from $url"
- curl --connect-timeout ${CURL_CONNECTION_TIMEOUT:-20} --retry ${CURL_RETRY:-5} --retr
y-delay ${CURL_RETRY_DELAY:-0} --retry-max-time ${CURL_RETRY_MAX_TIME:-60} -s -f -L "$url"
-o "$jpi"
+ curl --connect-timeout 5 --retry 5 --retry-delay 0 --retry-max-time 60 -s -f -L "$url
" -o "$jpi"
return $?
}
-checkIntegrity() {
+function checkIntegrity() {
local plugin jpi
plugin="$1"
jpi="$(getArchiveFilename "$plugin")"
- unzip -t -qq "$jpi" >/dev/null
+ zip -T "$jpi" >/dev/null
return $?
}
-resolveDependencies() {
+function resolveDependencies() {
local plugin jpi dependencies
plugin="$1"
jpi="$(getArchiveFilename "$plugin")"
@@ -94,7 +94,7 @@ resolveDependencies() {
echo " > $plugin depends on $dependencies"
- IFS=',' read -r -a array <<< "$dependencies"
+ IFS=',' read -a array <<< "$dependencies"
for d in "${array[@]}"
do
@@ -121,7 +121,7 @@ resolveDependencies() {
wait
}
-bundledPlugins() {
+function bundledPlugins() {
local JENKINS_WAR=/usr/share/jenkins/jenkins.war
if [ -f $JENKINS_WAR ]
then
@@ -143,7 +143,7 @@ bundledPlugins() {
fi
}
-versionFromPlugin() {
+function versionFromPlugin() {
local plugin=$1
if [[ $plugin =~ .*:.* ]]; then
echo "${plugin##*:}"
@@ -153,7 +153,7 @@ versionFromPlugin() {
}
-installedPlugins() {
+function installedPlugins() {
for f in "$REF_DIR"/*.jpi; do
echo "$(basename "$f" | sed -e 's/\.jpi//'):$(get_plugin_version "$f")"
done
@@ -170,10 +170,10 @@ main() {
mkdir "$(getLockFile "${plugin%%:*}")"
done
- echo "Analyzing war..."
+ echo -e "\nAnalyzing war..."
bundledPlugins="$(bundledPlugins)"
- echo "Downloading plugins..."
+ echo -e "\nDownloading plugins..."
for plugin in "$@"; do
version=""
@@ -194,11 +194,11 @@ main() {
installedPlugins
if [[ -f $FAILED ]]; then
- echo "Some plugins failed to download!" "$(<"$FAILED")" >&2
+ echo -e "\nSome plugins failed to download!\n$(<"$FAILED")" >&2
exit 1
fi
- echo "Cleaning up locks"
+ echo -e "\nCleaning up locks"
rm -r "$REF_DIR"/*.lock
}
diff --git a/jenkins_2.7.4/jenkins.sh b/jenkins_2.7.4/jenkins.sh
index 6cbe125..df1531d 100755
--- a/jenkins_2.7.4/jenkins.sh
+++ b/jenkins_2.7.4/jenkins.sh
@@ -1,25 +1,13 @@
#! /bin/bash -e
-: "${JENKINS_HOME:="/var/jenkins_home"}"
-touch "${COPY_REFERENCE_FILE_LOG}" || { echo "Can not write to ${COPY_REFERENCE_FILE_LOG}
. Wrong volume permissions?"; exit 1; }
+: ${JENKINS_HOME:="/var/jenkins_home"}
+touch "${COPY_REFERENCE_FILE_LOG}" || (echo "Can not write to ${COPY_REFERENCE_FILE_LOG}.
Wrong volume permissions?" && exit 1)
echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
-find /usr/share/jenkins/ref/ -type f -exec bash -c '. /usr/local/bin/jenkins-support; for
arg; do copy_reference_file "$arg"; done' _ {} +
+find /usr/share/jenkins/ref/ -type f -exec bash -c ". /usr/local/bin/jenkins-support; cop
y_reference_file '{}'" \;
# if `docker run` first argument start with `--` the user is passing jenkins launcher arg
uments
if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
-
- # read JAVA_OPTS and JENKINS_OPTS into arrays to avoid need for eval (and associated vu
lnerabilities)
- java_opts_array=()
- while IFS= read -r -d '' item; do
- java_opts_array+=( "$item" )
- done < <([[ $JAVA_OPTS ]] && xargs printf '%s\0' <<<"$JAVA_OPTS")
-
- jenkins_opts_array=( )
- while IFS= read -r -d '' item; do
- jenkins_opts_array+=( "$item" )
- done < <([[ $JENKINS_OPTS ]] && xargs printf '%s\0' <<<"$JENKINS_OPTS")
-
- exec java "${java_opts_array[@]}" -jar /usr/share/jenkins/jenkins.war "${jenkins_opts_a
rray[@]}" "$@"
+ eval "exec java $JAVA_OPTS -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
diff --git a/jenkins_2.7.4/plugins.sh b/jenkins_2.7.4/plugins.sh
index 9b08ddb..027c382 100755
--- a/jenkins_2.7.4/plugins.sh
+++ b/jenkins_2.7.4/plugins.sh
@@ -31,7 +31,7 @@ USAGE:
exit 1
else
JENKINS_INPUT_JOB_LIST=$1
- if [ ! -f "$JENKINS_INPUT_JOB_LIST" ]
+ if [ ! -f $JENKINS_INPUT_JOB_LIST ]
then
echo "ERROR File not found: $JENKINS_INPUT_JOB_LIST"
exit 1
@@ -40,7 +40,7 @@ fi
# the war includes a # of plugins, to make the build efficient filter out
# the plugins so we dont install 2x - there about 17!
-if [ -d "$JENKINS_HOME" ]
+if [ -d $JENKINS_HOME ]
then
TEMP_ALREADY_INSTALLED=$JENKINS_HOME/preinstalled.plugins.$$.txt
else
@@ -49,31 +49,33 @@ else
fi
JENKINS_PLUGINS_DIR=/var/jenkins_home/plugins
-if [ -d "$JENKINS_PLUGINS_DIR" ]
+if [ -d $JENKINS_PLUGINS_DIR ]
then
echo "Analyzing: $JENKINS_PLUGINS_DIR"
- for i in "$JENKINS_PLUGINS_DIR"/*/; do
- JENKINS_PLUGIN=$(basename "$i")
- JENKINS_PLUGIN_VER=$(egrep -i Plugin-Version "$i/META-INF/MANIFEST.MF"|cut -d: -f
2|sed 's/ //')
+ for i in `ls -pd1 $JENKINS_PLUGINS_DIR/*|egrep '\/$'`
+ do
+ JENKINS_PLUGIN=`basename $i`
+ JENKINS_PLUGIN_VER=`egrep -i Plugin-Version "$i/META-INF/MANIFEST.MF"|cut -d\: -f
2|sed 's/ //'`
echo "$JENKINS_PLUGIN:$JENKINS_PLUGIN_VER"
- done >"$TEMP_ALREADY_INSTALLED"
+ done > $TEMP_ALREADY_INSTALLED
else
JENKINS_WAR=/usr/share/jenkins/jenkins.war
- if [ -f "$JENKINS_WAR" ]
+ if [ -f $JENKINS_WAR ]
then
echo "Analyzing war: $JENKINS_WAR"
TEMP_PLUGIN_DIR=/tmp/plugintemp.$$
- while read -r i <&3; do
- rm -fr "$TEMP_PLUGIN_DIR"
- mkdir -p "$TEMP_PLUGIN_DIR"
- PLUGIN=$(basename "$i"|cut -f1 -d'.')
- (cd "$TEMP_PLUGIN_DIR" || exit; jar xf "$JENKINS_WAR" "$i"; jar xvf "$TEMP_PL
UGIN_DIR/$i" META-INF/MANIFEST.MF >/dev/null 2>&1)
- VER=$(egrep -i Plugin-Version "$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF"|cut -d:
-f2|sed 's/ //')
+ for i in `jar tf $JENKINS_WAR | egrep '[^detached-]plugins.*\..pi' | sort`
+ do
+ rm -fr $TEMP_PLUGIN_DIR
+ mkdir -p $TEMP_PLUGIN_DIR
+ PLUGIN=`basename $i|cut -f1 -d'.'`
+ (cd $TEMP_PLUGIN_DIR;jar xf $JENKINS_WAR "$i";jar xvf $TEMP_PLUGIN_DIR/$i MET
A-INF/MANIFEST.MF >/dev/null 2>&1)
+ VER=`egrep -i Plugin-Version "$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF"|cut -d\:
-f2|sed 's/ //'`
echo "$PLUGIN:$VER"
- done 3< <(jar tf "$JENKINS_WAR" | egrep '[^detached-]plugins.*\..pi' | sort) > "$
TEMP_ALREADY_INSTALLED"
- rm -fr "$TEMP_PLUGIN_DIR"
+ done > $TEMP_ALREADY_INSTALLED
+ rm -fr $TEMP_PLUGIN_DIR
else
- rm -f "$TEMP_ALREADY_INSTALLED"
+ rm -f $TEMP_ALREADY_INSTALLED
echo "ERROR file not found: $JENKINS_WAR"
exit 1
fi
@@ -82,30 +84,30 @@ fi
REF=/usr/share/jenkins/ref/plugins
mkdir -p $REF
COUNT_PLUGINS_INSTALLED=0
-while read -r spec || [ -n "$spec" ]; do
+while read spec || [ -n "$spec" ]; do
plugin=(${spec//:/ });
[[ ${plugin[0]} =~ ^# ]] && continue
- [[ ${plugin[0]} =~ ^[[:space:]]*$ ]] && continue
+ [[ ${plugin[0]} =~ ^\s*$ ]] && continue
[[ -z ${plugin[1]} ]] && plugin[1]="latest"
if [ -z "$JENKINS_UC_DOWNLOAD" ]; then
JENKINS_UC_DOWNLOAD=$JENKINS_UC/download
fi
- if ! grep -q "${plugin[0]}:${plugin[1]}" "$TEMP_ALREADY_INSTALLED"
+ if ! grep -q "${plugin[0]}:${plugin[1]}" $TEMP_ALREADY_INSTALLED
then
echo "Downloading ${plugin[0]}:${plugin[1]}"
- curl --retry 3 --retry-delay 5 -sSL -f "${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi" -o "$REF/${plugin[0]}.jpi"
- unzip -qqt "$REF/${plugin[0]}.jpi"
- (( COUNT_PLUGINS_INSTALLED += 1 ))
+ curl --retry 3 --retry-delay 5 -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi
+ unzip -qqt $REF/${plugin[0]}.jpi
+ COUNT_PLUGINS_INSTALLED=`expr $COUNT_PLUGINS_INSTALLED + 1`
else
echo " ... skipping already installed: ${plugin[0]}:${plugin[1]}"
fi
-done < "$JENKINS_INPUT_JOB_LIST"
+done < $JENKINS_INPUT_JOB_LIST
echo "---------------------------------------------------"
-if (( "$COUNT_PLUGINS_INSTALLED" > 0 ))
+if [ $COUNT_PLUGINS_INSTALLED -gt 0 ]
then
echo "INFO: Successfully installed $COUNT_PLUGINS_INSTALLED plugins."
@@ -120,5 +122,5 @@ fi
echo "---------------------------------------------------"
#cleanup
-rm "$TEMP_ALREADY_INSTALLED"
+rm $TEMP_ALREADY_INSTALLED
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build test of #2228; be5b159 (jenkins
):
$ bashbrew build jenkins:latest
warning: insecure protocol git:// detected: git://github.com/jenkinsci/jenkins-ci.org-docker
Using bashbrew/cache:33b18dcaca7f5fa9683e2257834f17c341a2f26cd62020c97d182517a88e628c (jenkins:latest)
Tagging jenkins:latest
Tagging jenkins:2.19.1
$ test/run.sh jenkins:latest
testing jenkins:latest
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
$ bashbrew build jenkins:2.7.4
Building bashbrew/cache:b0abb641622faa8df624cf0c13187369e5a6d30e12d2e94d90b982fe82b387dd (jenkins:2.7.4)
Tagging jenkins:2.7.4
$ test/run.sh jenkins:2.7.4
testing jenkins:2.7.4
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
$ bashbrew build jenkins:alpine
Using bashbrew/cache:f6011b351e849da10d25b4457513b2f0235785702ff692f9a21b2aed76033095 (jenkins:alpine)
Tagging jenkins:alpine
Tagging jenkins:2.19.1-alpine
$ test/run.sh jenkins:alpine
testing jenkins:alpine
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
$ bashbrew build jenkins:2.7.4-alpine
Building bashbrew/cache:addfc11305a671b2d9c66bf5d49dbe2a2196130f8865ef5ebb1669b77168d82e (jenkins:2.7.4-alpine)
Tagging jenkins:2.7.4-alpine
$ test/run.sh jenkins:2.7.4-alpine
testing jenkins:2.7.4-alpine
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
@@ -3,7 +3,9 @@ | |||
# maintainer: Carlos Sanchez <csanchez@cloudbees.com> (@carlossg) | |||
|
|||
latest: git://github.com/jenkinsci/jenkins-ci.org-docker@2fb0684fe6eb11a3c1145d71e0cb50bf2dda8d11 | |||
2.7.4: git://github.com/jenkinsci/jenkins-ci.org-docker@2fb0684fe6eb11a3c1145d71e0cb50bf2dda8d11 | |||
2.7.4: git://github.com/jenkinsci/jenkins-ci.org-docker@6eaa9b15926232310317490a3b9975ef61be763c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit id is the same as it was before (2.19.1 was tagged as 2.7.4). So this is fine.
I screwed the last PR #2226 overwriting the 2.7.4 tag