【发布时间】:2022-10-06 05:25:58
【问题描述】:
我需要一个脚本来获取需要更新的詹金斯插件列表,并每周发送有关它们的电子邮件通知。
我需要一个脚本来获取需要更新的詹金斯插件列表,并每周发送有关它们的电子邮件通知。
您可以使用以下脚本作为参考并构建管道以发送电子邮件。
// This cript prints all the installed plugins and if there are updates, the latest version available.
jenkins.model.Jenkins.getInstance().getUpdateCenter().getSites().each { site ->
site.updateDirectlyNow(hudson.model.DownloadService.signatureCheck)
}
hudson.model.DownloadService.Downloadable.all().each { downloadable ->
downloadable.updateNow();
}
def pluginList = new ArrayList(Jenkins.instance.pluginManager.plugins)
pluginList.sort { it.getShortName() }.each{ plugin ->
println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()} : ${plugin.hasUpdate() ? plugin.getUpdateInfo().version : 'No Update'}")
}
【讨论】: