Docker: The JENKINS_UC_DOWNLOAD environment variable seems not working

Created on 15 Aug 2020  Â·  3Comments  Â·  Source: jenkinsci/docker

I hava configured the JENKINS_UC_DOWNLOAD environment variable with docker-compose.yml,but it seems not working.

Docker commands that you execute

docker-compose up

and the docker-compose.yml file is below:

version: "3.7"

services:
  jenkins:
    container_name: jenkins
    image: jenkins/jenkins:2.204.6
    restart: unless-stopped
    privileged: true
    ports:
      - "8080:8080"
      - "50000:50000"
    dns:
      - 223.5.5.5
      - 8.8.8.8
    environment:
      JENKINS_UC_DOWNLOAD: "https://mirrors.tuna.tsinghua.edu.cn/jenkins"   
      JAVA_OPTS: "-Djava.awt.headless=true -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
    volumes:
      - ./jenkins_service/jenkins_certs:/certs/client
      - ./jenkins_service/jenkins_home:/var/jenkins_home
      - ./jenkins_service/jenkins_backup:/var/jenkins_backup
    deploy:
      resources:
        limits:
          memory: 2048M
          cpus: '2'
    networks:
      - jenkins_network

networks:
  jenkins_network:
    external: true

Actual result

The jenkins download plugin not from configed url but from jenkins office download center.

Expected outcome

The Jenkins should download plugin from my configed url.

Have you tried a non-dockerized Jenkins and get the expected outcome?

No.

Output of docker version

[jenkins@centos ~]$ docker  version
Client:
 Version:           18.09.5
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        e8ff056
 Built:             Thu Apr 11 04:43:34 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.5
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       e8ff056
  Built:            Thu Apr 11 04:13:40 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Other relevant information

2020-08-15 01:33:02.597+0000 [id=76]    SEVERE  h.model.UpdateCenter$DownloadJob#run: Failed to install ant
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:3061)
    at java.net.URLConnection.getHeaderFieldLong(URLConnection.java:629)
    at java.net.URLConnection.getContentLengthLong(URLConnection.java:501)
    at java.net.URLConnection.getContentLength(URLConnection.java:485)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1225)
Caused: java.net.SocketTimeoutException: Read timed out
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1950)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1945)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1944)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1514)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1241)
Caused: java.io.IOException: Failed to load http://updates.jenkins-ci.org/download/plugins/ant/1.11/ant.hpi to /var/jenkins_home/plugins/ant.jpi.tmp
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1248)
Caused: java.io.IOException: Failed to download from http://updates.jenkins-ci.org/download/plugins/ant/1.11/ant.hpi (redirected to: http://mirror.serverion.com/jenkins/plugins/ant/1.11/ant.hpi)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1282)
    at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1830)
    at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2101)
    at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1804)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:111)
    at java.lang.Thread.run(Thread.java:748)
2020-08-15 01:33:02.601+0000 [id=76]    INFO    h.model.UpdateCenter$DownloadJob#run: Starting the installation of ace-editor on behalf of admin

Most helpful comment

Hi @justyns and @Mr-LiuDC

Script install-plugins.sh has been deprecated:
https://github.com/jenkinsci/docker/commit/bc906140bcfba9d5435b1f94dbf5e5e109791815#diff-a4d47ab66a34ee55556a6fe9980384b4cac99cd08afd4f9d882606b70c21f618

To solve the issue:

  1. Upgrade docker image to the current LTS (2.249.3-lts) or higher version from repo
  2. Use plugin-installation-manager-tool instead of install-plugins.sh:

This issue can be closed I think.

All 3 comments

I have the same issue.
Plugins are downloaded from JENKINS_UC_DOWNLOAD related path, but plugin dependencies are downloaded from url="$JENKINS_UC_LATEST/latest/${plugin}.hpi"
This url depends on JENKINS_UC (http://updates.jenkins-ci.org by default)

    jenkinsUcJson=$(curl "${CURL_OPTIONS:--sSfL}" -o /dev/null -w "%{url_effective}" "${JENKINS_UC}/update-center.json?version=${jenkinsVersion}")
    if [ -n "${jenkinsUcJson}" ]; then
        JENKINS_UC_LATEST=${jenkinsUcJson//update-center.json/}
        echo "Using version-specific update center: $JENKINS_UC_LATEST..."
    else
        JENKINS_UC_LATEST=
    fi

So install-plugins.sh uses JENKINS_UC to resolve transitive dependencies even if I set custom JENKINS_UC_DOWNLOAD value.

We recently ran into the same issue as well. JENKINS_UC_DOWNLOAD is used for the plugins that get specified by the user, but plugin dependencies do not use it.

As a workaround, I am specifying all plugins and dependencies at the same time so that resolveDependencies never ends up trying to install the latest version of any plugin.

Hi @justyns and @Mr-LiuDC

Script install-plugins.sh has been deprecated:
https://github.com/jenkinsci/docker/commit/bc906140bcfba9d5435b1f94dbf5e5e109791815#diff-a4d47ab66a34ee55556a6fe9980384b4cac99cd08afd4f9d882606b70c21f618

To solve the issue:

  1. Upgrade docker image to the current LTS (2.249.3-lts) or higher version from repo
  2. Use plugin-installation-manager-tool instead of install-plugins.sh:

This issue can be closed I think.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

szimmer1 picture szimmer1  Â·  5Comments

ThStock picture ThStock  Â·  8Comments

manoj150283 picture manoj150283  Â·  3Comments

mabushey picture mabushey  Â·  5Comments

edumco picture edumco  Â·  6Comments