我正在使用带有 Throttle Concurrent Builds 插件的 Jenkins,并尝试在 jenkins 配置中添加 Throttle 类别(Jenkins=>manage Jenkins=> Configure System=>Throttle Concurrent Builds)。是否可以使用 groovy 对其进行配置?谢谢。
问问题
911 次
1 回答
3
String expectedLabel = "testLabel";
Integer expectedMax = new Integer(1);
ThrottleJobProperty.ThrottleCategory category =
new ThrottleJobProperty.ThrottleCategory('testCategoryName3', 0, 0, null);
List<ThrottleJobProperty.NodeLabeledPair> nodeLabeledPairs = category.getNodeLabeledPairs();
nodeLabeledPairs.add(new ThrottleJobProperty.NodeLabeledPair(expectedLabel, expectedMax));
ThrottleJobProperty.DescriptorImpl descriptor = Jenkins.getInstance().getDescriptorByType(ThrottleJobProperty.DescriptorImpl.class)
categories = descriptor.getCategories()
categories.add(category)
descriptor.save()
于 2016-01-22T13:58:39.927 回答