将Jenkins管道限制为仅在特定节点上运行 [英] Limiting Jenkins pipeline to running only on specific nodes

查看:1278
本文介绍了将Jenkins管道限制为仅在特定节点上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立将广泛使用Jenkins管道的作业.我们的节点是通过项目的标签来指定的,但是与常规作业不同,管道构建似乎没有限制在何处可以运行此项目"复选框.如何指定管道将在常规作业上运行的方式在哪个节点上运行?

I'm building jobs that will be using Jenkins piplines extensively. Our nodes are designated per project by their tags, but unlike regular jobs the pipeline build does not seem to have the "Restrict where this project can be run" checkbox. How can I specify on which node the pipeline will run the way I do for regular jobs?

推荐答案

在执行node步骤时,您可以指定所需的节点或标签:

You specify the desired node or tag when you do the node step:

node('specialSlave') {
   // Will run on the slave with name or tag specialSlave
}

请参见 https: //jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#code-node-code-allocate-node ,以获取node参数的扩展解释.

See https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#code-node-code-allocate-node for an extended explanation of the arguments to node.

这篇关于将Jenkins管道限制为仅在特定节点上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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