{"action":"created","issue":{"url":"https://api.github.com/repos/docker-library/official-images/issues/2226","repository_url":"https://api.github.com/repos/docker-library/official-images","labels_url":"https://api.github.com/repos/docker-library/official-images/issues/2226/labels{/name}","comments_url":"https://api.github.com/repos/docker-library/official-images/issues/2226/comments","events_url":"https://api.github.com/repos/docker-library/official-images/issues/2226/events","html_url":"https://github.com/docker-library/official-images/pull/2226","id":181533374,"number":2226,"title":"Jenkins 2.19.1","user":{"login":"carlossg","id":23651,"avatar_url":"https://avatars.githubusercontent.com/u/23651?v=3","gravatar_id":"","url":"https://api.github.com/users/carlossg","html_url":"https://github.com/carlossg","followers_url":"https://api.github.com/users/carlossg/followers","following_url":"https://api.github.com/users/carlossg/following{/other_user}","gists_url":"https://api.github.com/users/carlossg/gists{/gist_id}","starred_url":"https://api.github.com/users/carlossg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlossg/subscriptions","organizations_url":"https://api.github.com/users/carlossg/orgs","repos_url":"https://api.github.com/users/carlossg/repos","events_url":"https://api.github.com/users/carlossg/events{/privacy}","received_events_url":"https://api.github.com/users/carlossg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker-library/official-images/labels/library/jenkins","name":"library/jenkins","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-06T21:42:59Z","updated_at":"2016-10-06T22:17:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/docker-library/official-images/pulls/2226","html_url":"https://github.com/docker-library/official-images/pull/2226","diff_url":"https://github.com/docker-library/official-images/pull/2226.diff","patch_url":"https://github.com/docker-library/official-images/pull/2226.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/docker-library/official-images/issues/comments/252104308","html_url":"https://github.com/docker-library/official-images/pull/2226#issuecomment-252104308","issue_url":"https://api.github.com/repos/docker-library/official-images/issues/2226","id":252104308,"user":{"login":"yosifkit","id":896423,"avatar_url":"https://avatars.githubusercontent.com/u/896423?v=3","gravatar_id":"","url":"https://api.github.com/users/yosifkit","html_url":"https://github.com/yosifkit","followers_url":"https://api.github.com/users/yosifkit/followers","following_url":"https://api.github.com/users/yosifkit/following{/other_user}","gists_url":"https://api.github.com/users/yosifkit/gists{/gist_id}","starred_url":"https://api.github.com/users/yosifkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosifkit/subscriptions","organizations_url":"https://api.github.com/users/yosifkit/orgs","repos_url":"https://api.github.com/users/yosifkit/repos","events_url":"https://api.github.com/users/yosifkit/events{/privacy}","received_events_url":"https://api.github.com/users/yosifkit/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T22:17:07Z","updated_at":"2016-10-06T22:17:07Z","body":"```diff\r\ndiff --git a/jenkins_2.7.4-alpine/Dockerfile b/jenkins_2.7.4-alpine/Dockerfile\r\nindex 3f9e06b..100bb36 100644\r\n--- a/jenkins_2.7.4-alpine/Dockerfile\r\n+++ b/jenkins_2.7.4-alpine/Dockerfile\r\n@@ -1,6 +1,6 @@\r\n FROM openjdk:8-jdk-alpine\r\n\r\n-RUN apk add --no-cache git openssh-client curl zip unzip bash ttf-dejavu coreutils\r\n+RUN apk add --no-cache git openssh-client curl unzip bash ttf-dejavu coreutils\r\n\r\n ENV JENKINS_HOME /var/jenkins_home\r\n ENV JENKINS_SLAVE_AGENT_PORT 50000\r\n@@ -36,10 +36,10 @@ COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-\r\nport.groov\r\n\r\n # jenkins version being bundled in this docker image\r\n ARG JENKINS_VERSION\r\n-ENV JENKINS_VERSION ${JENKINS_VERSION:-2.7.4}\r\n+ENV JENKINS_VERSION ${JENKINS_VERSION:-2.19.1}\r\n\r\n # jenkins.war checksum, download will be validated using it\r\n-ARG JENKINS_SHA=07a2e3e4ace728fdbcc823f46068d2f8cc3cb97b\r\n+ARG JENKINS_SHA=dc28b91e553c1cd42cc30bd75d0f651671e6de0b\r\n\r\n # Can be used to customize where jenkins.war get downloaded from\r\n ARG JENKINS_URL=http://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKI\r\nNS_VERSION}/jenkins-war-${JENKINS_VERSION}.war\r\ndiff --git a/jenkins_2.7.4-alpine/install-plugins.sh b/jenkins_2.7.4-alpine/install-plugin\r\ns.sh\r\nindex 8b8daee..233b739 100755\r\n--- a/jenkins_2.7.4-alpine/install-plugins.sh\r\n+++ b/jenkins_2.7.4-alpine/install-plugins.sh\r\n@@ -12,15 +12,15 @@ FAILED=\"$REF_DIR/failed-plugins.txt\"\r\n\r\n . /usr/local/bin/jenkins-support\r\n\r\n-function getLockFile() {\r\n-    echo -n \"$REF_DIR/${1}.lock\"\r\n+getLockFile() {\r\n+    printf '%s' \"$REF_DIR/${1}.lock\"\r\n }\r\n\r\n-function getArchiveFilename() {\r\n-    echo -n \"$REF_DIR/${1}.jpi\"\r\n+getArchiveFilename() {\r\n+    printf '%s' \"$REF_DIR/${1}.jpi\"\r\n }\r\n\r\n-function download() {\r\n+download() {\r\n     local plugin originalPlugin version lock ignoreLockFile\r\n     plugin=\"$1\"\r\n     version=\"${2:-latest}\"\r\n@@ -50,7 +50,7 @@ function download() {\r\n     fi\r\n }\r\n\r\n-function doDownload() {\r\n+doDownload() {\r\n     local plugin version url jpi\r\n     plugin=\"$1\"\r\n     version=\"$2\"\r\n@@ -67,20 +67,20 @@ function doDownload() {\r\n     url=\"$JENKINS_UC_DOWNLOAD/plugins/$plugin/$version/${plugin}.hpi\"\r\n\r\n     echo \"Downloading plugin: $plugin from $url\"\r\n-    curl --connect-timeout 5 --retry 5 --retry-delay 0 --retry-max-time 60 -s -f -L \"$url\r\n\" -o \"$jpi\"\r\n+    curl --connect-timeout ${CURL_CONNECTION_TIMEOUT:-20} --retry ${CURL_RETRY:-5} --retr\r\ny-delay ${CURL_RETRY_DELAY:-0} --retry-max-time ${CURL_RETRY_MAX_TIME:-60} -s -f -L \"$url\"\r\n -o \"$jpi\"\r\n     return $?\r\n }\r\n\r\n-function checkIntegrity() {\r\n+checkIntegrity() {\r\n     local plugin jpi\r\n     plugin=\"$1\"\r\n     jpi=\"$(getArchiveFilename \"$plugin\")\"\r\n\r\n-    zip -T \"$jpi\" >/dev/null\r\n+    unzip -t -qq \"$jpi\" >/dev/null\r\n     return $?\r\n }\r\n\r\n-function resolveDependencies() {\r\n+resolveDependencies() {\r\n     local plugin jpi dependencies\r\n     plugin=\"$1\"\r\n     jpi=\"$(getArchiveFilename \"$plugin\")\"\r\n@@ -94,7 +94,7 @@ function resolveDependencies() {\r\n\r\n     echo \" > $plugin depends on $dependencies\"\r\n\r\n-    IFS=',' read -a array <<< \"$dependencies\"\r\n+    IFS=',' read -r -a array <<< \"$dependencies\"\r\n\r\n     for d in \"${array[@]}\"\r\n     do\r\n@@ -121,7 +121,7 @@ function resolveDependencies() {\r\n     wait\r\n }\r\n\r\n-function bundledPlugins() {\r\n+bundledPlugins() {\r\n     local JENKINS_WAR=/usr/share/jenkins/jenkins.war\r\n     if [ -f $JENKINS_WAR ]\r\n     then\r\n@@ -143,7 +143,7 @@ function bundledPlugins() {\r\n     fi\r\n }\r\n\r\n-function versionFromPlugin() {\r\n+versionFromPlugin() {\r\n     local plugin=$1\r\n     if [[ $plugin =~ .*:.* ]]; then\r\n         echo \"${plugin##*:}\"\r\n@@ -153,7 +153,7 @@ function versionFromPlugin() {\r\n\r\n }\r\n\r\n-function installedPlugins() {\r\n+installedPlugins() {\r\n     for f in \"$REF_DIR\"/*.jpi; do\r\n         echo \"$(basename \"$f\" | sed -e 's/\\.jpi//'):$(get_plugin_version \"$f\")\"\r\n     done\r\n@@ -170,10 +170,10 @@ main() {\r\n         mkdir \"$(getLockFile \"${plugin%%:*}\")\"\r\n     done\r\n\r\n-    echo -e \"\\nAnalyzing war...\"\r\n+    echo \"Analyzing war...\"\r\n     bundledPlugins=\"$(bundledPlugins)\"\r\n\r\n-    echo -e \"\\nDownloading plugins...\"\r\n+    echo \"Downloading plugins...\"\r\n     for plugin in \"$@\"; do\r\n         version=\"\"\r\n\r\n@@ -194,11 +194,11 @@ main() {\r\n     installedPlugins\r\n\r\n     if [[ -f $FAILED ]]; then\r\n-        echo -e \"\\nSome plugins failed to download!\\n$(<\"$FAILED\")\" >&2\r\n+        echo \"Some plugins failed to download!\" \"$(<\"$FAILED\")\" >&2\r\n         exit 1\r\n     fi\r\n\r\n-    echo -e \"\\nCleaning up locks\"\r\n+    echo \"Cleaning up locks\"\r\n     rm -r \"$REF_DIR\"/*.lock\r\n }\r\n\r\ndiff --git a/jenkins_2.7.4-alpine/jenkins.sh b/jenkins_2.7.4-alpine/jenkins.sh\r\nindex df1531d..6cbe125 100755\r\n--- a/jenkins_2.7.4-alpine/jenkins.sh\r\n+++ b/jenkins_2.7.4-alpine/jenkins.sh\r\n@@ -1,13 +1,25 @@\r\n #! /bin/bash -e\r\n\r\n-: ${JENKINS_HOME:=\"/var/jenkins_home\"}\r\n-touch \"${COPY_REFERENCE_FILE_LOG}\" || (echo \"Can not write to ${COPY_REFERENCE_FILE_LOG}.\r\n Wrong volume permissions?\" && exit 1)\r\n+: \"${JENKINS_HOME:=\"/var/jenkins_home\"}\"\r\n+touch \"${COPY_REFERENCE_FILE_LOG}\" || { echo \"Can not write to ${COPY_REFERENCE_FILE_LOG}\r\n. Wrong volume permissions?\"; exit 1; }\r\n echo \"--- Copying files at $(date)\" >> \"$COPY_REFERENCE_FILE_LOG\"\r\n-find /usr/share/jenkins/ref/ -type f -exec bash -c \". /usr/local/bin/jenkins-support; cop\r\ny_reference_file '{}'\" \\;\r\n+find /usr/share/jenkins/ref/ -type f -exec bash -c '. /usr/local/bin/jenkins-support; for\r\n arg; do copy_reference_file \"$arg\"; done' _ {} +\r\n\r\n # if `docker run` first argument start with `--` the user is passing jenkins launcher arg\r\numents\r\n if [[ $# -lt 1 ]] || [[ \"$1\" == \"--\"* ]]; then\r\n-  eval \"exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS \\\"\\$@\\\"\"\r\n+\r\n+  # read JAVA_OPTS and JENKINS_OPTS into arrays to avoid need for eval (and associated vu\r\nlnerabilities)\r\n+  java_opts_array=()\r\n+  while IFS= read -r -d '' item; do\r\n+    java_opts_array+=( \"$item\" )\r\n+  done < <([[ $JAVA_OPTS ]] && xargs printf '%s\\0' <<<\"$JAVA_OPTS\")\r\n+\r\n+  jenkins_opts_array=( )\r\n+  while IFS= read -r -d '' item; do\r\n+    jenkins_opts_array+=( \"$item\" )\r\n+  done < <([[ $JENKINS_OPTS ]] && xargs printf '%s\\0' <<<\"$JENKINS_OPTS\")\r\n+\r\n+  exec java \"${java_opts_array[@]}\" -jar /usr/share/jenkins/jenkins.war \"${jenkins_opts_a\r\nrray[@]}\" \"$@\"\r\n fi\r\n\r\n # As argument is not jenkins, assume user want to run his own process, for sample a `bash\r\n` shell to explore this image\r\ndiff --git a/jenkins_2.7.4-alpine/plugins.sh b/jenkins_2.7.4-alpine/plugins.sh\r\nindex 027c382..9b08ddb 100755\r\n--- a/jenkins_2.7.4-alpine/plugins.sh\r\n+++ b/jenkins_2.7.4-alpine/plugins.sh\r\n@@ -31,7 +31,7 @@ USAGE:\r\n     exit 1\r\n else\r\n     JENKINS_INPUT_JOB_LIST=$1\r\n-    if [ ! -f $JENKINS_INPUT_JOB_LIST ]\r\n+    if [ ! -f \"$JENKINS_INPUT_JOB_LIST\" ]\r\n     then\r\n         echo \"ERROR File not found: $JENKINS_INPUT_JOB_LIST\"\r\n         exit 1\r\n@@ -40,7 +40,7 @@ fi\r\n\r\n # the war includes a # of plugins, to make the build efficient filter out\r\n # the plugins so we dont install 2x - there about 17!\r\n-if [ -d $JENKINS_HOME ]\r\n+if [ -d \"$JENKINS_HOME\" ]\r\n then\r\n     TEMP_ALREADY_INSTALLED=$JENKINS_HOME/preinstalled.plugins.$$.txt\r\n else\r\n@@ -49,33 +49,31 @@ else\r\n fi\r\n\r\n JENKINS_PLUGINS_DIR=/var/jenkins_home/plugins\r\n-if [ -d $JENKINS_PLUGINS_DIR ]\r\n+if [ -d \"$JENKINS_PLUGINS_DIR\" ]\r\n then\r\n     echo \"Analyzing: $JENKINS_PLUGINS_DIR\"\r\n-    for i in `ls -pd1 $JENKINS_PLUGINS_DIR/*|egrep '\\/$'`\r\n-    do\r\n-        JENKINS_PLUGIN=`basename $i`\r\n-        JENKINS_PLUGIN_VER=`egrep -i Plugin-Version \"$i/META-INF/MANIFEST.MF\"|cut -d\\: -f\r\n2|sed 's/ //'`\r\n+    for i in \"$JENKINS_PLUGINS_DIR\"/*/; do\r\n+        JENKINS_PLUGIN=$(basename \"$i\")\r\n+        JENKINS_PLUGIN_VER=$(egrep -i Plugin-Version \"$i/META-INF/MANIFEST.MF\"|cut -d: -f\r\n2|sed 's/ //')\r\n         echo \"$JENKINS_PLUGIN:$JENKINS_PLUGIN_VER\"\r\n-    done > $TEMP_ALREADY_INSTALLED\r\n+    done >\"$TEMP_ALREADY_INSTALLED\"\r\n else\r\n     JENKINS_WAR=/usr/share/jenkins/jenkins.war\r\n-    if [ -f $JENKINS_WAR ]\r\n+    if [ -f \"$JENKINS_WAR\" ]\r\n     then\r\n         echo \"Analyzing war: $JENKINS_WAR\"\r\n         TEMP_PLUGIN_DIR=/tmp/plugintemp.$$\r\n-        for i in `jar tf $JENKINS_WAR | egrep '[^detached-]plugins.*\\..pi' | sort`\r\n-        do\r\n-            rm -fr $TEMP_PLUGIN_DIR\r\n-            mkdir -p $TEMP_PLUGIN_DIR\r\n-            PLUGIN=`basename $i|cut -f1 -d'.'`\r\n-            (cd $TEMP_PLUGIN_DIR;jar xf $JENKINS_WAR \"$i\";jar xvf $TEMP_PLUGIN_DIR/$i MET\r\nA-INF/MANIFEST.MF >/dev/null 2>&1)\r\n-            VER=`egrep -i Plugin-Version \"$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF\"|cut -d\\:\r\n -f2|sed 's/ //'`\r\n+        while read -r i <&3; do\r\n+            rm -fr \"$TEMP_PLUGIN_DIR\"\r\n+            mkdir -p \"$TEMP_PLUGIN_DIR\"\r\n+            PLUGIN=$(basename \"$i\"|cut -f1 -d'.')\r\n+            (cd \"$TEMP_PLUGIN_DIR\" || exit; jar xf \"$JENKINS_WAR\" \"$i\"; jar xvf \"$TEMP_PL\r\nUGIN_DIR/$i\" META-INF/MANIFEST.MF >/dev/null 2>&1)\r\n+            VER=$(egrep -i Plugin-Version \"$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF\"|cut -d:\r\n -f2|sed 's/ //')\r\n             echo \"$PLUGIN:$VER\"\r\n-        done > $TEMP_ALREADY_INSTALLED\r\n-        rm -fr $TEMP_PLUGIN_DIR\r\n+        done 3< <(jar tf \"$JENKINS_WAR\" | egrep '[^detached-]plugins.*\\..pi' | sort) > \"$\r\nTEMP_ALREADY_INSTALLED\"\r\n+        rm -fr \"$TEMP_PLUGIN_DIR\"\r\n     else\r\n-        rm -f $TEMP_ALREADY_INSTALLED\r\n+        rm -f \"$TEMP_ALREADY_INSTALLED\"\r\n         echo \"ERROR file not found: $JENKINS_WAR\"\r\n         exit 1\r\n     fi\r\n@@ -84,30 +82,30 @@ fi\r\n REF=/usr/share/jenkins/ref/plugins\r\n mkdir -p $REF\r\n COUNT_PLUGINS_INSTALLED=0\r\n-while read spec || [ -n \"$spec\" ]; do\r\n+while read -r spec || [ -n \"$spec\" ]; do\r\n\r\n     plugin=(${spec//:/ });\r\n     [[ ${plugin[0]} =~ ^# ]] && continue\r\n-    [[ ${plugin[0]} =~ ^\\s*$ ]] && continue\r\n+    [[ ${plugin[0]} =~ ^[[:space:]]*$ ]] && continue\r\n     [[ -z ${plugin[1]} ]] && plugin[1]=\"latest\"\r\n\r\n     if [ -z \"$JENKINS_UC_DOWNLOAD\" ]; then\r\n       JENKINS_UC_DOWNLOAD=$JENKINS_UC/download\r\n     fi\r\n\r\n-    if ! grep -q \"${plugin[0]}:${plugin[1]}\" $TEMP_ALREADY_INSTALLED\r\n+    if ! grep -q \"${plugin[0]}:${plugin[1]}\" \"$TEMP_ALREADY_INSTALLED\"\r\n     then\r\n         echo \"Downloading ${plugin[0]}:${plugin[1]}\"\r\n-        curl --retry 3 --retry-delay 5 -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]\r\n}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi\r\n-        unzip -qqt $REF/${plugin[0]}.jpi\r\n-        COUNT_PLUGINS_INSTALLED=`expr $COUNT_PLUGINS_INSTALLED + 1`\r\n+        curl --retry 3 --retry-delay 5 -sSL -f \"${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0\r\n]}/${plugin[1]}/${plugin[0]}.hpi\" -o \"$REF/${plugin[0]}.jpi\"\r\n+        unzip -qqt \"$REF/${plugin[0]}.jpi\"\r\n+        (( COUNT_PLUGINS_INSTALLED += 1 ))\r\n     else\r\n         echo \"  ... skipping already installed:  ${plugin[0]}:${plugin[1]}\"\r\n     fi\r\n-done  < $JENKINS_INPUT_JOB_LIST\r\n+done  < \"$JENKINS_INPUT_JOB_LIST\"\r\n\r\n echo \"---------------------------------------------------\"\r\n-if [ $COUNT_PLUGINS_INSTALLED -gt 0 ]\r\n+if (( \"$COUNT_PLUGINS_INSTALLED\" > 0 ))\r\n then\r\n     echo \"INFO: Successfully installed $COUNT_PLUGINS_INSTALLED plugins.\"\r\n\r\n@@ -122,5 +120,5 @@ fi\r\n echo \"---------------------------------------------------\"\r\n\r\n #cleanup\r\n-rm $TEMP_ALREADY_INSTALLED\r\n+rm \"$TEMP_ALREADY_INSTALLED\"\r\n exit 0\r\ndiff --git a/jenkins_2.7.4/Dockerfile b/jenkins_2.7.4/Dockerfile\r\nindex 0502845..28c4e31 100644\r\n--- a/jenkins_2.7.4/Dockerfile\r\n+++ b/jenkins_2.7.4/Dockerfile\r\n@@ -1,6 +1,6 @@\r\n FROM openjdk:8-jdk\r\n\r\n-RUN apt-get update && apt-get install -y git curl zip && rm -rf /var/lib/apt/lists/*\r\n+RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*\r\n\r\n ENV JENKINS_HOME /var/jenkins_home\r\n ENV JENKINS_SLAVE_AGENT_PORT 50000\r\n@@ -36,10 +36,10 @@ COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-\r\nport.groov\r\n\r\n # jenkins version being bundled in this docker image\r\n ARG JENKINS_VERSION\r\n-ENV JENKINS_VERSION ${JENKINS_VERSION:-2.7.4}\r\n+ENV JENKINS_VERSION ${JENKINS_VERSION:-2.19.1}\r\n\r\n # jenkins.war checksum, download will be validated using it\r\n-ARG JENKINS_SHA=07a2e3e4ace728fdbcc823f46068d2f8cc3cb97b\r\n+ARG JENKINS_SHA=dc28b91e553c1cd42cc30bd75d0f651671e6de0b\r\n\r\n # Can be used to customize where jenkins.war get downloaded from\r\n ARG JENKINS_URL=http://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKI\r\nNS_VERSION}/jenkins-war-${JENKINS_VERSION}.war\r\ndiff --git a/jenkins_2.7.4/install-plugins.sh b/jenkins_2.7.4/install-plugins.sh\r\nindex 8b8daee..233b739 100755\r\n--- a/jenkins_2.7.4/install-plugins.sh\r\n+++ b/jenkins_2.7.4/install-plugins.sh\r\n@@ -12,15 +12,15 @@ FAILED=\"$REF_DIR/failed-plugins.txt\"\r\n\r\n . /usr/local/bin/jenkins-support\r\n\r\n-function getLockFile() {\r\n-    echo -n \"$REF_DIR/${1}.lock\"\r\n+getLockFile() {\r\n+    printf '%s' \"$REF_DIR/${1}.lock\"\r\n }\r\n\r\n-function getArchiveFilename() {\r\n-    echo -n \"$REF_DIR/${1}.jpi\"\r\n+getArchiveFilename() {\r\n+    printf '%s' \"$REF_DIR/${1}.jpi\"\r\n }\r\n\r\n-function download() {\r\n+download() {\r\n     local plugin originalPlugin version lock ignoreLockFile\r\n     plugin=\"$1\"\r\n     version=\"${2:-latest}\"\r\n@@ -50,7 +50,7 @@ function download() {\r\n     fi\r\n }\r\n\r\n-function doDownload() {\r\n+doDownload() {\r\n     local plugin version url jpi\r\n     plugin=\"$1\"\r\n     version=\"$2\"\r\n@@ -67,20 +67,20 @@ function doDownload() {\r\n     url=\"$JENKINS_UC_DOWNLOAD/plugins/$plugin/$version/${plugin}.hpi\"\r\n\r\n     echo \"Downloading plugin: $plugin from $url\"\r\n-    curl --connect-timeout 5 --retry 5 --retry-delay 0 --retry-max-time 60 -s -f -L \"$url\r\n\" -o \"$jpi\"\r\n+    curl --connect-timeout ${CURL_CONNECTION_TIMEOUT:-20} --retry ${CURL_RETRY:-5} --retr\r\ny-delay ${CURL_RETRY_DELAY:-0} --retry-max-time ${CURL_RETRY_MAX_TIME:-60} -s -f -L \"$url\"\r\n -o \"$jpi\"\r\n     return $?\r\n }\r\n\r\n-function checkIntegrity() {\r\n+checkIntegrity() {\r\n     local plugin jpi\r\n     plugin=\"$1\"\r\n     jpi=\"$(getArchiveFilename \"$plugin\")\"\r\n\r\n-    zip -T \"$jpi\" >/dev/null\r\n+    unzip -t -qq \"$jpi\" >/dev/null\r\n     return $?\r\n }\r\n\r\n-function resolveDependencies() {\r\n+resolveDependencies() {\r\n     local plugin jpi dependencies\r\n     plugin=\"$1\"\r\n     jpi=\"$(getArchiveFilename \"$plugin\")\"\r\n@@ -94,7 +94,7 @@ function resolveDependencies() {\r\n\r\n     echo \" > $plugin depends on $dependencies\"\r\n\r\n-    IFS=',' read -a array <<< \"$dependencies\"\r\n+    IFS=',' read -r -a array <<< \"$dependencies\"\r\n\r\n     for d in \"${array[@]}\"\r\n     do\r\n@@ -121,7 +121,7 @@ function resolveDependencies() {\r\n     wait\r\n }\r\n\r\n-function bundledPlugins() {\r\n+bundledPlugins() {\r\n     local JENKINS_WAR=/usr/share/jenkins/jenkins.war\r\n     if [ -f $JENKINS_WAR ]\r\n     then\r\n@@ -143,7 +143,7 @@ function bundledPlugins() {\r\n     fi\r\n }\r\n\r\n-function versionFromPlugin() {\r\n+versionFromPlugin() {\r\n     local plugin=$1\r\n     if [[ $plugin =~ .*:.* ]]; then\r\n         echo \"${plugin##*:}\"\r\n@@ -153,7 +153,7 @@ function versionFromPlugin() {\r\n\r\n }\r\n\r\n-function installedPlugins() {\r\n+installedPlugins() {\r\n     for f in \"$REF_DIR\"/*.jpi; do\r\n         echo \"$(basename \"$f\" | sed -e 's/\\.jpi//'):$(get_plugin_version \"$f\")\"\r\n     done\r\n@@ -170,10 +170,10 @@ main() {\r\n         mkdir \"$(getLockFile \"${plugin%%:*}\")\"\r\n     done\r\n\r\n-    echo -e \"\\nAnalyzing war...\"\r\n+    echo \"Analyzing war...\"\r\n     bundledPlugins=\"$(bundledPlugins)\"\r\n\r\n-    echo -e \"\\nDownloading plugins...\"\r\n+    echo \"Downloading plugins...\"\r\n     for plugin in \"$@\"; do\r\n         version=\"\"\r\n\r\n@@ -194,11 +194,11 @@ main() {\r\n     installedPlugins\r\n\r\n     if [[ -f $FAILED ]]; then\r\n-        echo -e \"\\nSome plugins failed to download!\\n$(<\"$FAILED\")\" >&2\r\n+        echo \"Some plugins failed to download!\" \"$(<\"$FAILED\")\" >&2\r\n         exit 1\r\n     fi\r\n\r\n-    echo -e \"\\nCleaning up locks\"\r\n+    echo \"Cleaning up locks\"\r\n     rm -r \"$REF_DIR\"/*.lock\r\n }\r\n\r\ndiff --git a/jenkins_2.7.4/jenkins.sh b/jenkins_2.7.4/jenkins.sh\r\nindex df1531d..6cbe125 100755\r\n--- a/jenkins_2.7.4/jenkins.sh\r\n+++ b/jenkins_2.7.4/jenkins.sh\r\n@@ -1,13 +1,25 @@\r\n #! /bin/bash -e\r\n\r\n-: ${JENKINS_HOME:=\"/var/jenkins_home\"}\r\n-touch \"${COPY_REFERENCE_FILE_LOG}\" || (echo \"Can not write to ${COPY_REFERENCE_FILE_LOG}.\r\n Wrong volume permissions?\" && exit 1)\r\n+: \"${JENKINS_HOME:=\"/var/jenkins_home\"}\"\r\n+touch \"${COPY_REFERENCE_FILE_LOG}\" || { echo \"Can not write to ${COPY_REFERENCE_FILE_LOG}\r\n. Wrong volume permissions?\"; exit 1; }\r\n echo \"--- Copying files at $(date)\" >> \"$COPY_REFERENCE_FILE_LOG\"\r\n-find /usr/share/jenkins/ref/ -type f -exec bash -c \". /usr/local/bin/jenkins-support; cop\r\ny_reference_file '{}'\" \\;\r\n+find /usr/share/jenkins/ref/ -type f -exec bash -c '. /usr/local/bin/jenkins-support; for\r\n arg; do copy_reference_file \"$arg\"; done' _ {} +\r\n\r\n # if `docker run` first argument start with `--` the user is passing jenkins launcher arg\r\numents\r\n if [[ $# -lt 1 ]] || [[ \"$1\" == \"--\"* ]]; then\r\n-  eval \"exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS \\\"\\$@\\\"\"\r\n+\r\n+  # read JAVA_OPTS and JENKINS_OPTS into arrays to avoid need for eval (and associated vu\r\nlnerabilities)\r\n+  java_opts_array=()\r\n+  while IFS= read -r -d '' item; do\r\n+    java_opts_array+=( \"$item\" )\r\n+  done < <([[ $JAVA_OPTS ]] && xargs printf '%s\\0' <<<\"$JAVA_OPTS\")\r\n+\r\n+  jenkins_opts_array=( )\r\n+  while IFS= read -r -d '' item; do\r\n+    jenkins_opts_array+=( \"$item\" )\r\n+  done < <([[ $JENKINS_OPTS ]] && xargs printf '%s\\0' <<<\"$JENKINS_OPTS\")\r\n+\r\n+  exec java \"${java_opts_array[@]}\" -jar /usr/share/jenkins/jenkins.war \"${jenkins_opts_a\r\nrray[@]}\" \"$@\"\r\n fi\r\n\r\n # As argument is not jenkins, assume user want to run his own process, for sample a `bash\r\n` shell to explore this image\r\ndiff --git a/jenkins_2.7.4/plugins.sh b/jenkins_2.7.4/plugins.sh\r\nindex 027c382..9b08ddb 100755\r\n--- a/jenkins_2.7.4/plugins.sh\r\n+++ b/jenkins_2.7.4/plugins.sh\r\n@@ -31,7 +31,7 @@ USAGE:\r\n     exit 1\r\n else\r\n     JENKINS_INPUT_JOB_LIST=$1\r\n-    if [ ! -f $JENKINS_INPUT_JOB_LIST ]\r\n+    if [ ! -f \"$JENKINS_INPUT_JOB_LIST\" ]\r\n     then\r\n         echo \"ERROR File not found: $JENKINS_INPUT_JOB_LIST\"\r\n         exit 1\r\n@@ -40,7 +40,7 @@ fi\r\n\r\n # the war includes a # of plugins, to make the build efficient filter out\r\n # the plugins so we dont install 2x - there about 17!\r\n-if [ -d $JENKINS_HOME ]\r\n+if [ -d \"$JENKINS_HOME\" ]\r\n then\r\n     TEMP_ALREADY_INSTALLED=$JENKINS_HOME/preinstalled.plugins.$$.txt\r\n else\r\n@@ -49,33 +49,31 @@ else\r\n fi\r\n\r\n JENKINS_PLUGINS_DIR=/var/jenkins_home/plugins\r\n-if [ -d $JENKINS_PLUGINS_DIR ]\r\n+if [ -d \"$JENKINS_PLUGINS_DIR\" ]\r\n then\r\n     echo \"Analyzing: $JENKINS_PLUGINS_DIR\"\r\n-    for i in `ls -pd1 $JENKINS_PLUGINS_DIR/*|egrep '\\/$'`\r\n-    do\r\n-        JENKINS_PLUGIN=`basename $i`\r\n-        JENKINS_PLUGIN_VER=`egrep -i Plugin-Version \"$i/META-INF/MANIFEST.MF\"|cut -d\\: -f\r\n2|sed 's/ //'`\r\n+    for i in \"$JENKINS_PLUGINS_DIR\"/*/; do\r\n+        JENKINS_PLUGIN=$(basename \"$i\")\r\n+        JENKINS_PLUGIN_VER=$(egrep -i Plugin-Version \"$i/META-INF/MANIFEST.MF\"|cut -d: -f\r\n2|sed 's/ //')\r\n         echo \"$JENKINS_PLUGIN:$JENKINS_PLUGIN_VER\"\r\n-    done > $TEMP_ALREADY_INSTALLED\r\n+    done >\"$TEMP_ALREADY_INSTALLED\"\r\n else\r\n     JENKINS_WAR=/usr/share/jenkins/jenkins.war\r\n-    if [ -f $JENKINS_WAR ]\r\n+    if [ -f \"$JENKINS_WAR\" ]\r\n     then\r\n         echo \"Analyzing war: $JENKINS_WAR\"\r\n         TEMP_PLUGIN_DIR=/tmp/plugintemp.$$\r\n-        for i in `jar tf $JENKINS_WAR | egrep '[^detached-]plugins.*\\..pi' | sort`\r\n-        do\r\n-            rm -fr $TEMP_PLUGIN_DIR\r\n-            mkdir -p $TEMP_PLUGIN_DIR\r\n-            PLUGIN=`basename $i|cut -f1 -d'.'`\r\n-            (cd $TEMP_PLUGIN_DIR;jar xf $JENKINS_WAR \"$i\";jar xvf $TEMP_PLUGIN_DIR/$i MET\r\nA-INF/MANIFEST.MF >/dev/null 2>&1)\r\n-            VER=`egrep -i Plugin-Version \"$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF\"|cut -d\\:\r\n -f2|sed 's/ //'`\r\n+        while read -r i <&3; do\r\n+            rm -fr \"$TEMP_PLUGIN_DIR\"\r\n+            mkdir -p \"$TEMP_PLUGIN_DIR\"\r\n+            PLUGIN=$(basename \"$i\"|cut -f1 -d'.')\r\n+            (cd \"$TEMP_PLUGIN_DIR\" || exit; jar xf \"$JENKINS_WAR\" \"$i\"; jar xvf \"$TEMP_PL\r\nUGIN_DIR/$i\" META-INF/MANIFEST.MF >/dev/null 2>&1)\r\n+            VER=$(egrep -i Plugin-Version \"$TEMP_PLUGIN_DIR/META-INF/MANIFEST.MF\"|cut -d:\r\n -f2|sed 's/ //')\r\n             echo \"$PLUGIN:$VER\"\r\n-        done > $TEMP_ALREADY_INSTALLED\r\n-        rm -fr $TEMP_PLUGIN_DIR\r\n+        done 3< <(jar tf \"$JENKINS_WAR\" | egrep '[^detached-]plugins.*\\..pi' | sort) > \"$\r\nTEMP_ALREADY_INSTALLED\"\r\n+        rm -fr \"$TEMP_PLUGIN_DIR\"\r\n     else\r\n-        rm -f $TEMP_ALREADY_INSTALLED\r\n+        rm -f \"$TEMP_ALREADY_INSTALLED\"\r\n         echo \"ERROR file not found: $JENKINS_WAR\"\r\n         exit 1\r\n     fi\r\n@@ -84,30 +82,30 @@ fi\r\n REF=/usr/share/jenkins/ref/plugins\r\n mkdir -p $REF\r\n COUNT_PLUGINS_INSTALLED=0\r\n-while read spec || [ -n \"$spec\" ]; do\r\n+while read -r spec || [ -n \"$spec\" ]; do\r\n\r\n     plugin=(${spec//:/ });\r\n     [[ ${plugin[0]} =~ ^# ]] && continue\r\n-    [[ ${plugin[0]} =~ ^\\s*$ ]] && continue\r\n+    [[ ${plugin[0]} =~ ^[[:space:]]*$ ]] && continue\r\n     [[ -z ${plugin[1]} ]] && plugin[1]=\"latest\"\r\n\r\n     if [ -z \"$JENKINS_UC_DOWNLOAD\" ]; then\r\n       JENKINS_UC_DOWNLOAD=$JENKINS_UC/download\r\n     fi\r\n\r\n-    if ! grep -q \"${plugin[0]}:${plugin[1]}\" $TEMP_ALREADY_INSTALLED\r\n+    if ! grep -q \"${plugin[0]}:${plugin[1]}\" \"$TEMP_ALREADY_INSTALLED\"\r\n     then\r\n         echo \"Downloading ${plugin[0]}:${plugin[1]}\"\r\n-        curl --retry 3 --retry-delay 5 -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi\r\n-        unzip -qqt $REF/${plugin[0]}.jpi\r\n-        COUNT_PLUGINS_INSTALLED=`expr $COUNT_PLUGINS_INSTALLED + 1`\r\n+        curl --retry 3 --retry-delay 5 -sSL -f \"${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi\" -o \"$REF/${plugin[0]}.jpi\"\r\n+        unzip -qqt \"$REF/${plugin[0]}.jpi\"\r\n+        (( COUNT_PLUGINS_INSTALLED += 1 ))\r\n     else\r\n         echo \"  ... skipping already installed:  ${plugin[0]}:${plugin[1]}\"\r\n     fi\r\n-done  < $JENKINS_INPUT_JOB_LIST\r\n+done  < \"$JENKINS_INPUT_JOB_LIST\"\r\n\r\n echo \"---------------------------------------------------\"\r\n-if [ $COUNT_PLUGINS_INSTALLED -gt 0 ]\r\n+if (( \"$COUNT_PLUGINS_INSTALLED\" > 0 ))\r\n then\r\n     echo \"INFO: Successfully installed $COUNT_PLUGINS_INSTALLED plugins.\"\r\n\r\n@@ -122,5 +120,5 @@ fi\r\n echo \"---------------------------------------------------\"\r\n\r\n #cleanup\r\n-rm $TEMP_ALREADY_INSTALLED\r\n+rm \"$TEMP_ALREADY_INSTALLED\"\r\n exit 0\r\n```"}}
{"actor":{"display_login":"yosifkit"}}