Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins 如何使用脚本添加多项目限制类别_Jenkins_Jenkins Plugins_Throttling_Jenkins Groovy - Fatal编程技术网

Jenkins 如何使用脚本添加多项目限制类别

Jenkins 如何使用脚本添加多项目限制类别,jenkins,jenkins-plugins,throttling,jenkins-groovy,Jenkins,Jenkins Plugins,Throttling,Jenkins Groovy,我正在使用Jenkins with Throttle Concurrent Builds插件,并尝试在Jenkins配置中添加Throttle类别(Jenkins=>manage Jenkins=>Configure System=>Throttle Concurrent Builds)。是否可以使用groovy对其进行配置?谢谢。String expectedLabel=“testLabel”; String expectedLabel = "testLabel"; Integer exp

我正在使用Jenkins with Throttle Concurrent Builds插件,并尝试在Jenkins配置中添加Throttle类别(Jenkins=>manage Jenkins=>Configure System=>Throttle Concurrent Builds)。是否可以使用groovy对其进行配置?谢谢。

String expectedLabel=“testLabel”;
 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()
整数expectedMax=新整数(1); ThrottleJobProperty.ThrottleCategory类别= 新的ThrottleJobProperty.ThrottleCategory('testCategoryName3',0,0,null); List nodeLabeledPairs=category.getNodeLabeledPairs(); 添加(新的ThrottleJobProperty.NodeLabeledPair(expectedLabel,expectedMax)); ThrottleJobProperty.DescriptorImpl descriptor=Jenkins.getInstance().getDescriptorByType(ThrottleJobProperty.DescriptorImpl.class) categories=descriptor.getCategories() 类别。添加(类别) descriptor.save()