我尝试使用Jenkins CLI安装Jenkins插件,命令如下:
java -jar jenkins-cli.jar -s http://localhost:8080 -auth @cred install-plugin https://updates.jenkins.io/download/plugins/htmlpublisher/1.31/htmlpublisher.hpi
得到了错误
Installing a plugin from https://updates.jenkins.io/download/plugins/htmlpublisher/1.31/htmlpublisher.hpi
ERROR: Unexpected exception occurred while performing install-plugin command.
java.net.UnknownHostException: updates.jenkins.io
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:305)
at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:507)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:373)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:207)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:193)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
at java.base/java.net.URL.openStream(URL.java:1165)
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1068)
at hudson.cli.InstallPluginCommand.run(InstallPluginCommand.java:110)
at hudson.cli.CLICommand.main(CLICommand.java:251)
at hudson.cli.CLIAction$ServerSideImpl.run(CLIAction.java:299)
at hudson.cli.CLIAction$1.lambda$opened$0(CLIAction.java:154)
at java.base/java.lang.Thread.run(Thread.java:829)
我试过的:
- 使用其他服务器:**java -jar jenkins-cli.jar -s http://localhost:8080-auth @cred install-plugin https://get.jenkins.io/plugins/htmlpublisher/1.31/htmlpublisher.hpi**并得到相同的错误
- 从Jenkins UI安装一个类似的插件,这很成功。
Jenkins版本:简体中文(zh_cn)
感谢你的帮助。
2条答案
按热度按时间r6l8ljro1#
此URL已过期:https://updates.jenkins.io/download/plugins并迁移到新的url:https://get.jenkins.io/plugins
请尝试新的URL
wwwo4jvm2#
我发现另一个解决方案是使用REST API来安装特定的Jenkins插件版本(降级/升级Jenkins插件版本)
例如:
然后重新启动Jenkins x1c 0d1x
多田!结果
P/S:我想使用REST API,而不是使用GUI,因为与REST API,我们可以写一个自动化脚本安装插件版本列表列表按要求.