问题描述
在作业配置中,有一个复选框限制可以在哪里运行该项目".如果选择它,那么将有一个有关标签表达"的输入字段.有没有办法在其中插入正则表达式,而不是确切的名称?如果是,您可以提供一个示例吗?其背后的整个概念是,我想将限制作业分配给自动创建的具有相似名称的从属
In job configuration, there is a checkbox "Restrict where this project can be run". If you select it, there is an input field about Label Expression.Is there a way to insert of regex there, and not the exact name?If yes, could you provide an example of this?The whole concept behind this, is that I want to assign restrict jobs to slaves that are created automatically, with similar names
推荐答案
我不认为该字段可以处理正则表达式,但是您不必指定从属的 name ;您可以指定与从属服务器关联的标签.
I don't believe that field can handle regular expressions, but you don't have to specify the name of the slave; you can specify a label associated with the slave.
创建从站时,为其分配一个或多个标签.为所有适合该作业的从站分配相同的标签.在作业中,将其限制为仅在该标签上运行.具有标签的从站可以运行该作业.
When you create the slave, assign a label (or labels) to it. Assign the same label to all of the slaves that are suitable for that job. In the job, restrict it to run only on that label. A slave that has label can run that job.
这篇关于将通配符/正则表达式放在Jenkins的节点/标签限制中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!