有人问如何创建一个代理,它创建了一个从节点( here ),我不知道这是真的还是假的:
agent {
label 'my-defined-label'
}
和
agent {
node {
label 'my-defined-label'
customWorkspace '/some/other/path'
}
}
那么“my-define-label”只是从属名称?
谢谢各位的解答
最佳答案
它可以匹配精确的节点名称、标签、任何其他支持的标签表达式。例如,java8 && linux
、(docker || java) && !windows
和 corp-agent-node-01-name
都是有效的标签语法。
documentation清楚内置语法的工作原理:
Allocates an executor on a node (typically a slave) and runs further code in the context of a workspace on that slave.
label
- Computer name, label name, or any other label expression likelinux && 64bit
to restrict where this step builds. May be left blank, in which case any available executor is taken.Valid Operators
The following operators are supported, in the order of precedence.
(expr) - parenthesis
!expr - negation
expr&&expr - and
expr||expr - or
a -> b - "implies" operator. Equivalent to !a|b. For example, windows->x64 could be thought of as "if run on a Windows slave, that slave must be 64bit." *It still allows Jenkins to run this build on linux.
a <-> b - "if and only if" operator. Equivalent to a&&b || !a&&!b. For example, windows<->sfbay could be thought of as "if run on a Windows slave, that slave must be in the SF bay area, but if not on Windows, it must not be in the bay area."
All operators are left-associative (i.e., a->b->c <-> (a->b)->c ) An expression can contain whitespace for better readability, and it'll be ignored.
Label names or slave names can be quoted if they contain unsafe characters. For example, "jenkins-solaris (Solaris)" || "Windows 2008"
关于带标签或节点的Jenkins管道代理调用从节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47698227/