Jenkins Groovy Postbuild使用静态文件而不是脚本 [英] Jenkins Groovy Postbuild use static file instead of script

查看:357
本文介绍了Jenkins Groovy Postbuild使用静态文件而不是脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将外部groovy脚本加载到groovy post build插件中,而不是将脚本内容粘贴到每个作业中?我们有大约200个工作,所以更新它们都相当耗时。我知道我可以编写一个脚本来直接更新配置文件(如本文所示:为所有工作添加Jenkins Groovy Postbuild步骤),但这些工作全天候运行,因此在重新启动Jenkins或重新加载配置时发现窗口是有问题的。

Is it possible to load an external groovy script into the groovy post build plugin instead of pasting the script content into each job? We have approximately 200 jobs so updating them all is rather time consuming. I know that I could write a script to update the config files directly (as in this post: Add Jenkins Groovy Postbuild step to all jobs), but these jobs run 24x7 so finding a window when I can restart Jenkins or reload the config is problematic.

感谢!

Thanks!

推荐答案

更新:这真正解决了我的问题:< a href =https://issues.jenkins-ci.org/browse/JENKINS-21480 =nofollow> https://issues.jenkins-ci.org/browse/JENKINS-21480

Update: This is what really solved it for me: https://issues.jenkins-ci.org/browse/JENKINS-21480

我可以这样做,在Groovy脚本框中输入这些代替脚本的代码:

"I am able to do just that by doing the following. Enter these lines in lieu of the script in the "Groovy script" box:"

// Delegate to an external script
// The filename must match the class name
import JenkinsPostBuild
def postBuild = new JenkinsPostBuild(manager)
postBuild.run()

然后在Additional groovy classpath框中输入该文件的路径。

"Then in the "Additional groovy classpath" box enter the path to that file."

这篇关于Jenkins Groovy Postbuild使用静态文件而不是脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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