通过脚本更改现有Jenkins节点上的执行程序数

我不能编写脚本并更改已存在的节点(非主节点)上的执行程序数.最好通过使用groovy,但如果有插件或CLI命令可以做的也很有趣.

我想要做的片段:

jenkins.model.Jenkins.instance.nodes.each { node ->
  println node.getNumExecutors()

  //How do I set the number of executors for a node?
}

最佳答案 目前这不可能 – Jenkins节点的numExecutors属性是只读的.

JENKINS-23534开始:

[setNumExecutors] is intentionally private since Jenkins does not offer a way to change the number of executors of a SlaveComputer or Slave once created. Instead, you change the configuration, meaning replacing the existing Slave.

点赞