当代理禁止关键字 ftp 时如何更改 Jenkins 镜像

How to change Jenkins mirror, when proxy forbids keyword ftp

当我安装像 'git-plugin' 这样的 jenkins 插件时,jenkins 会将我的请求重定向到镜像 ftp.halifax.rwth-aachen.de。但是我在一个禁止请求 URL 包含单词 'ftp' 的公司代理后面工作。

在为jenkins 下载插件时,有没有办法选择或禁用镜像? Jenkins 从不包含 'ftp'.

的站点安装插件没有问题

这是来自 jenkins 日志视图的错误:

Dez 22, 2016 3:46:54 PM INFORMATION hudson.model.UpdateCenter$DownloadJob run
Starting the installation of Git client plugin on behalf of admin-ci
Dez 22, 2016 3:46:54 PM SCHWERWIEGEND hudson.model.UpdateCenter$DownloadJob run
Failed to install Git client plugin
hudson.util.IOException2: Failed to download from http://updates.jenkins-ci.org/download/plugins/git-client/2.1.0/git-client.hpi (redirected to: http://ftp.halifax.rwth-aachen.de/jenkins/plugins/git-client/2.1.0/git-client.hpi)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1169)
    at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1666)
    at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1864)
    at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1640)
    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:110)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://ftp.halifax.rwth-aachen.de/jenkins/plugins/git-client/2.1.0/git-client.hpi
    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.run(HttpURLConnection.java:1926)
    at sun.net.www.protocol.http.HttpURLConnection.run(HttpURLConnection.java:1921)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1121)
    ... 7 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://ftp.halifax.rwth-aachen.de/jenkins/plugins/git-client/2.1.0/git-client.hpi
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2982)
    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:1120)
    ... 7 more

    enter code here

我找到了解决方法:

  1. 直接从http://mirrors.jenkins-ci.org/plugins/gitlab-plugin/latest/

  2. 下载插件
  3. 将 hpi 文件上传到 jenkins。有一个 http://host:8080/pluginManager/advanced.

  4. 中的上传字段

但这只是一种解决方法。我想得到我的问题的答案:“有没有办法在以下情况下选择或禁用镜像正在为 jenkins 下载插件?"

Jenkins 默认为我使用 http://updates.jenkins-ci.org/update-center.json as a "load balancer" url which forwards you to the closest geographical mirror json (i.e. http://ftp-nyc.osuosl.org/pub/jenkins/updates/current/update-center.json)。你可以做的是通过安装这个插件和主机 json 文件来使用你自己的 json 文件到你想要的任何地方(即内部):

https://wiki.jenkins.io/display/JENKINS/UpdateSites+Manager+plugin