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

时间:2016-12-22 14:54:01

标签: url jenkins proxy ftp mirror

当我安装jenkins-plugin之类的' git-plugin'时,jenkins会将我的请求重定向到镜像 ftp.halifax.rwth-aachen.de 。但我在一个公司代理服务器后面工作,该代理服务器禁止对包含“ftp”字样的URL的请求。

下载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$10.run(HttpURLConnection.java:1926)
    at sun.net.www.protocol.http.HttpURLConnection$10.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

2 个答案:

答案 0 :(得分:3)

默认情况下,詹金斯(Jenkins)使用http://updates.jenkins-ci.org/update-center.json作为“负载均衡器” URL,它将您转发到最近的地理镜像json(即http://ftp-nyc.osuosl.org/pub/jenkins/updates/current/update-center.json对我而言)。为此,您可以通过在任意位置(即内部)安装此插件并托管json文件来使用自己的json文件:

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

enter image description here

答案 1 :(得分:2)

我找到了解决方法:

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

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

  4. 但这只是一种解决方法。我想得到一个问题的答案:" 在为jenkins下载插件时是否有办法选择或禁用镜像?"