使用 install-plugin 命令安装特定版本的插件

问题描述 投票:0回答:2

我看不到如何做到这一点的例子: https://jenkins.io/doc/book/managing/plugins/

我备份了所有已安装插件及其版本的列表。

我想使用 install-plugin 命令安装列表中的所有插件(及其特定版本)。

我没有看到为安装插件命令指定版本的选项

jenkins jenkins-plugins jenkins-cli
2个回答
7
投票

要安装特定版本,您可以运行命令并传递带有冒号的参数,如下所示:

install-plugins.sh git:3.9.1

或者将插件列表添加到文件中(例如

plugins.txt
):

git:3.9.1
saml:1.0.7

并使用以下命令运行它:

install-plugins.sh plugins.txt

对于 Jenkins 2.357 及更高版本,install-plugins.sh 已被删除。命令现在应该是这样的:

/bin/jenkins-plugin-cli -f /usr/share/jenkins/ref/plugins.txt


0
投票

您可以从这里下载 jar 文件:https://github.com/jenkinsci/plugin-installation-manager-tool

$ rm -rf /usr/share/jenkins/plugins/ldap*

$ ls /usr/share/jenkins/plugins/ldap*
ls: cannot access '/usr/share/jenkins/plugins/ldap*': No such file or directory

$ echo $JAVA_OPTS
-Djenkins.install.runSetupWizard=false

$ java $JAVA_OPTS -jar /opt/jenkins-plugin-manager-2.12.8.jar --plugins ldap:2.7
Done

$ ls /usr/share/jenkins/plugins/ldap*
/usr/share/jenkins/plugins/ldap.jpi

$ echo "http://<jenkins-url>/restart"
http://<jenkins-url>/restart

$ ls /usr/share/jenkins/plugins/ldap*
/usr/share/jenkins/plugins/ldap.jpi

/usr/share/jenkins/plugins/ldap:
META-INF  WEB-INF

$ cat /usr/share/jenkins/plugins/ldap/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: rsandell
Build-Jdk: 1.8.0_211
Extension-Name: ldap
Specification-Title: The Jenkins Plugins Parent POM Project
Implementation-Title: ldap
Implementation-Version: 2.7
Group-Id: org.jenkins-ci.plugins
Short-Name: ldap
Long-Name: LDAP Plugin
Url: https://github.com/jenkinsci/ldap-plugin
Compatible-Since-Version: 1.16
Minimum-Java-Version: 1.8
Plugin-Version: 2.7
Hudson-Version: 2.277.1
Jenkins-Version: 2.277.1
Plugin-Dependencies: mailer:1.34
Plugin-Developers:
Plugin-License-Name: The MIT license
Plugin-License-Url: https://opensource.org/licenses/MIT
Plugin-ScmUrl: https://github.com/jenkinsci/ldap-plugin

© www.soinside.com 2019 - 2024. All rights reserved.