带标签或节点的Jenkins管道代理调用从节点?

标签 jenkins jenkins-pipeline jenkins-slave

有人问如何创建一个代理,它创建了一个从节点( here ),我不知道这是真的还是假的:

agent {
  label 'my-defined-label'
}

agent {
  node {
    label 'my-defined-label'
    customWorkspace '/some/other/path'
  }
}

那么“my-define-label”只是从属名称?

谢谢各位的解答

最佳答案

它可以匹配精确的节点名称、标签、任何其他支持的标签表达式。例如,java8 && linux(docker || java) && !windowscorp-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 like linux && 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/

相关文章:

java - 如何在果冻中实现无选择 <f :select/>?

docker - Jenkins管道Docker-容器未运行

jenkins - 无法解析类 XmlParser.parseText

docker - Jenkins 声明性管道 : How can I mount a temporary volume associated with the workspace in a docker container?

java - Jenkins:\Java\jdk1.8.0_172\jre\bin""这时候没想到

jenkins - Jenkins管道cmd'无法识别为内部或外部命令可操作程序或批处理文件

Jenkins :日志文件在从属节点上的位置?

github - 本地主机 IP 地址 :8080 -in webhooks of github +jenkins

continuous-integration - 可以使用 hudson/jenkins 的不同发送电子邮件地址吗? (或者每个入口的所有项目是否只有一封全局构建电子邮件?)

Jenkins 管道里程碑不会取消之前正在进行的构建