如何使用命令列表及其短名称列出所有可用的jenkins插件 [英] How to list all available jenkins plugins using command list with their short names

查看:95
本文介绍了如何使用命令列表及其短名称列出所有可用的jenkins插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用命令行选项列出所有可用的插件名称和它们的简称,以便可以通过jenkins命令行自动化所需的插件安装.

I want to list all available plugins names and their short names using command line option, so that I could automate required plugin installation through jenkins command line.

请告知.谢谢

  • 到目前为止,我试图在同一位置找到答案,但是我仅获得有关如何列出已安装插件的答案,而不是所有可用插件的答案.
  • 我已经找到此链接 http://updates.jenkins-ci.org/download/plugins/,其中列出了所有插件,但仅带有短名称
  • So far I tried to find answer on same however I got answer only for how to list installed plugins, not for all available plugins.
  • I've found this link http://updates.jenkins-ci.org/download/plugins/ which lists all plugins but with their short names only

推荐答案

您是如此亲密! 这里的布局详细.该信息在附近供您解析,希望我理解正确.

You were so close! The LAYOUT is detailed here. The information is nearby for you to parse, hopefully I got it right.

http://updates.jenkins-ci.org/download/plugins/确实是插件的位置,实际的插件版本位于每个文件夹中.

http://updates.jenkins-ci.org/download/plugins/ is indeed the location of the plugins, with the actual plugin versions sitting inside each folder.

https://updates.jenkins.io/是根级别.您可以在 plugin-versions.json 中找到所有插件的列表和详细信息.

https://updates.jenkins.io/ is the root level. You will find the list of all plugins and details at plugin-versions.json.

update-center.js, update-center.json update-center.json.html 包含JSON,JSONP和HTML格式.您可以解析json以提取您要查找的所有内容.还提供了有关文档URL,发行历史记录以及更新的列表.

update-center.js, update-center.json, and update-center.json.html contain actual update center metadata in JSON, JSONP, and HTML format respectively. You can parse the json to pull everything you are looking for. There are also lists for the documentation url and the release history, as well as the updates.

这就是细微之处.有稳定(即:LTS)或

This is where it's nuanced; there's stable (ie:LTS) or latest (ie:weekly) and major releases of each. Each one has its own sublist, depending on minimum version and compatibility.

插件选择 由于这些都不能告诉您插件的实际作用,因此最好的办法是在 https://plugins上选择插件. jenkins.io/.单击任何插件(例如: mailer )将显示带有详细信息的标题块:

Plugin Selection Since none of this tells you what the plugins actually do, the best thing is to choose your plugins at https://plugins.jenkins.io/. Clicking on any plugin (eg: mailer) reveals a header block with details:

邮件程序 1.23
Jenkins的最低要求:1.642.3
ID:邮件

Mailer 1.23
Minimum Jenkins requirement: 1.642.3
ID: mailer

ID是您要查找的简称.浏览并找到您要使用的插件,这就是您的列表.不用担心依赖关系.

The ID is the short name you are looking for. Go through and find the plugins you want to use and that's your list. Don't worry about the dependencies.

关于插件管理

即使在独立实例上,我也使用了经过修改的Docker脚本 install_plugins.sh 生成要安装的插件的完整列表.

Even on a standalone instance, I use a modified script of Docker install_plugins.sh to generate the full list of plugins to install .

您可以检查输出或使用下面的常规脚本简化必须拥有"列表.另外,由于依赖项更新一直在发生,因此如果我需要完全相同地重新应用于其他实例(而不是从策展的列表中),我还会生成一个实际安装的更新列表.我的推荐清单是〜45个插件,安装了115个以上.

You can examine the outputs or use the groovy script that follows to simplify your "must have" list. Also, as dependency updates happen all the time, I also generate a list of actual installed updates if I need to reapply identically to a different instance rather than from my curated list. My curated list is ~45 plugins, with over 115 getting installed.

例如:workflow-api包括[workflow-scm-step],其中[workflow-scm-step]包括[git, subversion],因此无需指定git.但是您想知道您使用的是哪个版本.有时,您可能需要显式添加一个依赖关系,以获取最新的依赖关系,以避免出现缺陷,每个 JENKINS -54018

eg: workflow-api includes [workflow-scm-step] which includes [git, subversion], so no need to specify git. But you want to know which version you got. Occasionally you may need to explicitly add a dependency to get the latest to avoid a defect, per JENKINS-54018, plugins which were split from Jenkins.

println "Jenkins Instance : " + Jenkins.getInstance().getComputer('').getHostName() + " - " + Jenkins.getInstance().getRootUrl() 
println "Installed Plugins: "
println "=================="
Jenkins.instance.pluginManager.plugins.sort(false) { a, b -> a.getShortName().toLowerCase() <=> b.getShortName().toLowerCase()}.each { plugin ->
   println "${plugin.getShortName()}:${plugin.getVersion()} | ${plugin.getDisplayName()} "
}

println""
println "Plugins Dependency tree (...: dependencies; +++: dependants) :"
println "======================="
Jenkins.instance.pluginManager.plugins.sort(false) { a, b -> a.getShortName().toLowerCase() <=> b.getShortName().toLowerCase()}.each { plugin ->
   println "${plugin.getShortName()}:${plugin.getVersion()} | ${plugin.getDisplayName()} "
   println "+++ ${plugin.getDependants()}"
   println "... ${plugin.getDependencies()}"
   println ''
}

return

这篇关于如何使用命令列表及其短名称列出所有可用的jenkins插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆