简体   繁体   English

使用 Groovy 脚本在 Jenkins 从节点中运行作业

[英]Running jobs in Jenkins slave node using Groovy script

I am confused about whether a Jenkins job can be run using Groovy script in the slave node.我对是否可以在从节点中使用 Groovy 脚本运行 Jenkins 作业感到困惑。 I referred a StackOverflow answer [ 1 ] which says that System Groovy script jobs can be run in master and not in slave, and to run a job in slave it has to be Groovy script rather than System Groovy Script.我提到了一个 StackOverflow 答案 [ 1 ],它说系统 Groovy 脚本作业可以在主机中运行,而不是在从机中运行,并且要在从机中运行作业,它必须是 Groovy 脚本而不是系统 Z2D19C57FDD4FDC270C9ZEEDScript16。 Can someone clarify me whether we can run a slave job using System Groovy Script?有人能澄清一下我们是否可以使用系统 Groovy 脚本运行从属作业吗? Since I am trying through Groovy script I am unable to access few Jenkins instances.由于我正在尝试通过 Groovy 脚本,我无法访问少数 Jenkins 实例。 Please suggest me a better way with an explanation.请给我一个更好的解释方法。 Thanks in advance提前致谢

I have finally found that it is only possible to run jobs in Jenkins slave node using Grovvy script.我终于发现只能使用 Grovvy 脚本在 Jenkins 从节点中运行作业。 The system groovy script runs inside the Hudson master's JVM.系统 groovy 脚本在 Hudson master 的 JVM 内运行。 Thus it will have access to all the internal objects of Hudson, so we can use this to alter the state of Hudson.因此它将可以访问 Hudson 的所有内部对象,因此我们可以使用它来更改 Hudson 的 state。 It is similar to the Jenkins Script Console functionality.它类似于 Jenkins 脚本控制台功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM