Jenkins 节点 属性 'usage' 以及如何使用 python 更新

Jenkins node property 'usage' and how to update with python

关于如何使用 python 在 jenkins 中设置用法 属性,我看了很多地方。我查看了 create_node 但没有关于用法的参数或我找到的参数。我还查看了 reconfig_node,但查看了当前的 xml,我没有看到 xml 中的用法字段需要更新以供使用。所以不确定如何更新或创建可以设置用法的节点 属性.

我知道如何手动设置,但我目前有一个 python 脚本来创建节点,但用法始终设置为 'Use this node as much as possible'。

所以我正在寻找一种方法来在创建节点时设置节点的用法,或者在创建节点后进行更新。

config.xml 中,使用情况使用 <mode></mode> 标签存储。两种使用模式是:

  1. NORMAL - "Use this node as much as possible"
  2. EXCLUSIVE - "Only build jobs with label expressions matching this node"

对于Jenkins python API create_node 方法,我认为你需要查看exclusive 参数:

  1. exclusive=False - NORMAL - "Use this node as much as possible"
  2. exclusive=True - EXCLUSIVE - "Only build jobs with label expressions matching this node"