Skip to content
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

The JENKINS_UC_DOWNLOAD environment variable seems not working #977

Closed
Mr-LiuDC opened this issue Aug 15, 2020 · 3 comments
Closed

The JENKINS_UC_DOWNLOAD environment variable seems not working #977

Mr-LiuDC opened this issue Aug 15, 2020 · 3 comments

Comments

@Mr-LiuDC
Copy link

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

@dnskr
Copy link
Contributor

dnskr commented Oct 27, 2020

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.

@justyns
Copy link

justyns commented Nov 13, 2020

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.

@dnskr
Copy link
Contributor

dnskr commented Nov 13, 2020

Hi @justyns and @Mr-LiuDC

Script install-plugins.sh has been deprecated:
bc90614#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants