我想获取以给定名称开头的作业列表,然后更新作业可以运行的标签节点。我做了以下并没有成功。我在这里缺少的任何输入。
import hudson.model.*;
import hudson.util.*;
import hudson.model.labels.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
buildableItems = Jenkins.instance.getAllItems.each {job ->
job.name.startsWith("Automation -")
println job.fullName;
}
for(item in buildableItems) {
job.assignedlabel = new LabelAtom('new-label-name')
item.save()
}