本文整理汇总了Java中hudson.model.Label类的典型用法代码示例。如果您正苦于以下问题:Java Label类的具体用法?Java Label怎么用?Java Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Label类属于hudson.model包,在下文中一共展示了Label类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: NomadSlaveTemplate
import hudson.model.Label; //导入依赖的package包/类
@DataBoundConstructor
public NomadSlaveTemplate(
String cpu,
String memory,
String disk,
String labels,
String remoteFs,
String idleTerminationInMinutes,
String region,
String priority,
String image
) {
this.cpu = Integer.parseInt(cpu);
this.memory = Integer.parseInt(memory);
this.disk = Integer.parseInt(disk);
this.priority = Integer.parseInt(priority);
this.idleTerminationInMinutes = Integer.parseInt(idleTerminationInMinutes);
this.remoteFs = remoteFs;
this.labels = Util.fixNull(labels);
this.labelSet = Label.parse(labels);
this.region = region;
this.image = image;
readResolve();
}
开发者ID:iverberk,项目名称:jenkins-nomad,代码行数:26,代码来源:NomadSlaveTemplate.java
示例2: provision
import hudson.model.Label; //导入依赖的package包/类
@Override
public Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) {
List<NodeProvisioner.PlannedNode> nodes = new ArrayList<>();
final NomadSlaveTemplate template = getTemplate(label);
try {
while (excessWorkload > 0) {
LOGGER.log(Level.INFO, "Excess workload, provisioning new Jenkins slave on Nomad cluster");
final String slaveName = template.createSlaveName();
nodes.add(new NodeProvisioner.PlannedNode(
slaveName,
NomadComputer.threadPoolForRemoting.submit(
new ProvisioningCallback(slaveName, template, this)
), template.getNumExecutors()));
excessWorkload -= template.getNumExecutors();
}
return nodes;
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Unable to schedule new Jenkins slave on Nomad cluster, message: " + e.getMessage());
}
return Collections.emptyList();
}
开发者ID:iverberk,项目名称:jenkins-nomad,代码行数:26,代码来源:NomadCloud.java
示例3: onStarted
import hudson.model.Label; //导入依赖的package包/类
@Override @Restricted(DoNotUse.class)
public void onStarted(Cloud cloud, Label label, Collection<NodeProvisioner.PlannedNode> plannedNodes) {
BulkChange change = new BulkChange(stats);
try {
boolean changed = false;
for (NodeProvisioner.PlannedNode plannedNode : plannedNodes) {
ProvisioningActivity.Id id = getIdFor(plannedNode);
if (id != null) {
onStarted(id);
changed = true;
}
}
if (changed) {
// Not using change.commit() here as persist handles exceptions already
stats.persist();
}
} finally {
change.abort();
}
}
开发者ID:jenkinsci,项目名称:cloud-stats-plugin,代码行数:22,代码来源:CloudStatistics.java
示例4: provision
import hudson.model.Label; //导入依赖的package包/类
@Override
public Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) {
try {
List<NodeProvisioner.PlannedNode> r = new ArrayList<NodeProvisioner.PlannedNode>();
final ECSTaskTemplate template = getTemplate(label);
for (int i = 1; i <= excessWorkload; i++) {
r.add(new NodeProvisioner.PlannedNode(template.getDisplayName(), Computer.threadPoolForRemoting
.submit(new ProvisioningCallback(template, label)), 1));
}
return r;
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to provision ECS slave", e);
return Collections.emptyList();
}
}
开发者ID:cloudbees,项目名称:amazon-ecs-plugin,代码行数:19,代码来源:ECSCloud.java
示例5: getDockerClouds
import hudson.model.Label; //导入依赖的package包/类
@Nonnull
public List<DockerCloud> getDockerClouds(Label label) {
List<DockerCloud> provisionClouds;
//create a random list of docker clouds and prioritize idle clouds
List<DockerCloud> availableClouds = getAvailableDockerClouds(label);
if (availableClouds.size() > 0) {
//select available clouds based on label which have potential capacity
LOG.debug("Picking from available clouds.");
provisionClouds = availableClouds;
} else {
//if there's no available clouds then fall back to original behavior
LOG.debug("Falling back to getting all clouds regardless of availability.");
provisionClouds = getAllDockerClouds();
}
//randomize the order of the DockerCloud list
Collections.shuffle(provisionClouds);
//sort by least loaded DockerCloud (i.e. fewest provisioned slaves)
provisionClouds.sort(new DockerCloudLoadComparator());
LOG.debug("Least loaded randomized DockerCloud: " +
((provisionClouds.size() > 0) ? provisionClouds.get(0).name : "none available"));
return provisionClouds;
}
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:27,代码来源:RandomLeastLoadedDockerCloudOrder.java
示例6: getTemplates
import hudson.model.Label; //导入依赖的package包/类
/**
* Multiple templates may have the same label.
*
* @return Templates matched to requested label assuming slave Mode
*/
@Nonnull
public List<DockerSlaveTemplate> getTemplates(Label label) {
List<DockerSlaveTemplate> dockerSlaveTemplates = new ArrayList<>();
for (DockerSlaveTemplate t : templates) {
if (isNull(label) && t.getMode() == Node.Mode.NORMAL) {
dockerSlaveTemplates.add(t);
}
if (nonNull(label) && label.matches(t.getLabelSet())) {
dockerSlaveTemplates.add(t);
}
}
return dockerSlaveTemplates;
}
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:22,代码来源:AbstractCloud.java
示例7: readResolve
import hudson.model.Label; //导入依赖的package包/类
/**
* Initializes data structure that we don't persist.
*/
@SuppressWarnings("unused")
public Object readResolve() {
if (configVersion < 1) {
if (isNull(nodeProperties)) nodeProperties = new ArrayList<>();
nodeProperties.add(new DockerNodeProperty("DOCKER_CONTAINER_ID", "JENKINS_CLOUD_ID", "DOCKER_HOST"));
configVersion = 1;
}
// real @Nonnull
if (mode == null) {
mode = Node.Mode.NORMAL;
}
if (retentionStrategy == null) {
retentionStrategy = new DockerOnceRetentionStrategy(10);
}
try {
labelSet = Label.parse(getLabelString()); // fails sometimes under debugger
} catch (Throwable t) {
LOG.error("Can't parse labels: {}", t);
}
return this;
}
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:29,代码来源:DockerSlaveTemplate.java
示例8: readResolve
import hudson.model.Label; //导入依赖的package包/类
/**
* Initializes data structure that we don't persist.
*/
protected Object readResolve() {
labelSet = Label.parse(labels);
securityGroupSet = parseSecurityGroups();
/**
* In releases of this plugin prior to 1.18, template-specific instance caps could be configured
* but were not enforced. As a result, it was possible to have the instance cap for a template
* be configured to 0 (zero) with no ill effects. Starting with version 1.18, template-specific
* instance caps are enforced, so if a configuration has a cap of zero for a template, no instances
* will be launched from that template. Since there is no practical value of intentionally setting
* the cap to zero, this block will override such a setting to a value that means 'no cap'.
*/
if (instanceCap == 0) {
instanceCap = Integer.MAX_VALUE;
}
if (amiType == null) {
amiType = new UnixData(rootCommandPrefix, sshPort);
}
return this;
}
开发者ID:hudson3-plugins,项目名称:ec2-plugin,代码行数:25,代码来源:SlaveTemplate.java
示例9: RavelloSlaveBlueprint
import hudson.model.Label; //导入依赖的package包/类
@DataBoundConstructor
public RavelloSlaveBlueprint(String blueprintName, int blueprintId, String slaveName, String remoteFS, String nodeDescription, RetentionStrategy retentionStrategy, int port, String credentialsId,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd,
Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime, String labelString){
super(blueprintName, blueprintId);
this.slaveName = slaveName;
this.remoteFS = remoteFS;
this.nodeDescription = nodeDescription;
this.retentionStrategy = retentionStrategy;
this.port = port;
this.credentialsId = credentialsId;
this.jvmOptions = jvmOptions;
this.javaPath = javaPath;
this.prefixStartSlaveCmd = prefixStartSlaveCmd;
this.suffixStartSlaveCmd = suffixStartSlaveCmd;
this.launchTimeoutSeconds = launchTimeoutSeconds;
this.maxNumRetries = maxNumRetries;
this.retryWaitTime = retryWaitTime;
this.labelString = labelString;
labelSet = Label.parse(labelString);
}
开发者ID:ravello,项目名称:ravello-jenkins-plugin,代码行数:23,代码来源:RavelloSlaveBlueprint.java
示例10: getTemplate
import hudson.model.Label; //导入依赖的package包/类
public SlaveTemplate getTemplate(Label label) {
if (label == null && templates.size() > 0) {
return templates.get(0);
}
if ("master".equals(label.getName())) {
if (templates.size() > 0) {
return templates.get(0);
} else {
return null;
}
}
for (SlaveTemplate t : templates) {
if(label == null || label.matches(t.getLabelSet())) {
return t;
}
}
return null;
}
开发者ID:pulse00,项目名称:digitalocean-plugin,代码行数:22,代码来源:Cloud.java
示例11: getTemplates
import hudson.model.Label; //导入依赖的package包/类
/**
* Multiple amis can have the same label.
*
* @return Templates matched to requested label assuming slave Mode
*/
public List<DockerTemplate> getTemplates(Label label) {
ArrayList<DockerTemplate> dockerTemplates = new ArrayList<>();
for (DockerTemplate t : templates) {
if (label == null && t.getMode() == Node.Mode.NORMAL) {
dockerTemplates.add(t);
}
if (label != null && label.matches(t.getLabelSet())) {
dockerTemplates.add(t);
}
}
// add temporary templates matched to requested label
for (DockerTemplate template : getJobTemplates().values()) {
if (label != null && label.matches(template.getLabelSet())) {
dockerTemplates.add(template);
}
}
return dockerTemplates;
}
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:28,代码来源:DockerCloud.java
示例12: DockerTemplate
import hudson.model.Label; //导入依赖的package包/类
@DataBoundConstructor
public DockerTemplate(@Nonnull DockerTemplateBase dockerTemplateBase,
DockerComputerConnector connector,
String labelString,
String remoteFs,
String instanceCapStr
) {
this.dockerTemplateBase = dockerTemplateBase;
this.connector = connector;
this.labelString = Util.fixNull(labelString);
this.remoteFs = Strings.isNullOrEmpty(remoteFs) ? "/home/jenkins" : remoteFs;
if (instanceCapStr.equals("")) {
this.instanceCap = Integer.MAX_VALUE;
} else {
this.instanceCap = Integer.parseInt(instanceCapStr);
}
labelSet = Label.parse(labelString);
}
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:21,代码来源:DockerTemplate.java
示例13: should_connect_agent
import hudson.model.Label; //导入依赖的package包/类
protected void should_connect_agent(DockerTemplate template) throws IOException, ExecutionException, InterruptedException {
// FIXME on CI windows nodes don't have Docker4Windows
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);
String dockerHost = SystemUtils.IS_OS_WINDOWS ? "tcp://localhost:2375" : "unix:///var/run/docker.sock";
DockerCloud cloud = new DockerCloud("docker", new DockerAPI(new DockerServerEndpoint(dockerHost, null)),
Collections.singletonList(template));
j.jenkins.clouds.replaceBy(Collections.singleton(cloud));
final FreeStyleProject project = j.createFreeStyleProject("test-docker-ssh");
project.setAssignedLabel(Label.get("docker-agent"));
project.getBuildersList().add(new Shell("whoami"));
final FreeStyleBuild build = project.scheduleBuild2(0).get();
Assert.assertTrue(build.getResult() == Result.SUCCESS);
Assert.assertTrue(build.getLog().contains("jenkins"));
}
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:20,代码来源:DockerComputerConnectorTest.java
示例14: setLabel
import hudson.model.Label; //导入依赖的package包/类
/**
* Set the default Slave Info Label if no Label is assigned to the {@link Item}
* @param item
*/
private void setLabel(final Item item) {
if (item instanceof AbstractProject) {
AbstractProject<?, ?> job = (AbstractProject<?, ?>) item;
LOGGER.fine("MesosListener.setLabel(), setting label");
Label label = job.getAssignedLabel();
try {
if (label == null) { // No label assigned, override now
LOGGER.log(Level.FINE, "No label assigned to job - " + job.getDisplayName() + ". Assigning a label now...");
label = getLabel();
if (label != null) {
LOGGER.log(Level.INFO, "Assigned \"" + label.getName() + "\" to job \"" + job.getDisplayName() + "\"");
job.setAssignedLabel(label);
}
}
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to assign label \"" + label + "\" to " + job.getDisplayName(), e);
}
}
}
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:24,代码来源:MesosItemListener.java
示例15: getLabel
import hudson.model.Label; //导入依赖的package包/类
/**
* Get the default Slave Info Label as Hudson {@link hudson.model.Label}
* @return
*/
private Label getLabel() {
Label label = null;
// get mesos cloud
MesosCloud cloud = MesosCloud.get();
if(cloud != null) {
// get all label associate with cloud
List<MesosSlaveInfo> list = cloud.getSlaveInfos();
if(list != null && list.size() > 0) {
for (MesosSlaveInfo slaveInfo: list) {
if (slaveInfo.isDefaultSlave()) {
label = Hudson.getInstance().getLabel(slaveInfo.getLabelString());
break;
}
}
}
}
return label;
}
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:23,代码来源:MesosItemListener.java
示例16: canProvision
import hudson.model.Label; //导入依赖的package包/类
@Override
public boolean canProvision(Label label) {
// Provisioning is simply creating a task for a jenkins slave.
// We can provision a Mesos slave as long as the job's label matches any
// item in the list of configured Mesos labels.
// TODO(vinod): The framework may not have the resources necessary
// to start a task when it comes time to launch the slave.
if (slaveInfos != null) {
for (MesosSlaveInfo slaveInfo : slaveInfos) {
if (slaveInfo.matchesLabel(label)) {
return true;
}
}
}
return false;
}
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:17,代码来源:MesosCloud.java
示例17: doCheckLabelExpression
import hudson.model.Label; //导入依赖的package包/类
/**
* Verify the input label expression
*
* @param value
* @return
*/
public FormValidation doCheckLabelExpression(@QueryParameter String value)
{
if(StringUtils.isBlank(value))
{
return FormValidation.error(Messages.BuildPreference_labelExpression_requied());
}
try
{
Label l = LabelExpression.parseExpression(value);
if(l.getNodes().isEmpty())
{
return FormValidation.warning(Messages.BuildPreference_labelExpression_empty());
}
}
catch(ANTLRException e)
{
return FormValidation.error(e, Messages.BuildPreference_labelExpression_invalid());
}
return FormValidation.ok();
}
开发者ID:ikedam,项目名称:scoring-load-balancer,代码行数:28,代码来源:BuildPreference.java
示例18: testScriptedPipeline
import hudson.model.Label; //导入依赖的package包/类
@Test
public void testScriptedPipeline() throws Exception {
String agentLabel = "my-agent";
jenkins.createOnlineSlave(Label.get(agentLabel));
WorkflowJob job = jenkins.createProject(WorkflowJob.class, "test-scripted-pipeline");
String pipelineScript
= "node {\n"
+ " greet '" + name + "'\n"
+ "}";
job.setDefinition(new CpsFlowDefinition(pipelineScript, true));
WorkflowRun completedBuild = jenkins.assertBuildStatusSuccess(job.scheduleBuild2(0));
String expectedString = "Hello, " + name + "!";
jenkins.assertLogContains(expectedString, completedBuild);
}
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:15,代码来源:HelloWorldBuilderTest.java
示例19: getTemplate
import hudson.model.Label; //导入依赖的package包/类
public NomadSlaveTemplate getTemplate(Label label) {
for (NomadSlaveTemplate t : templates) {
if (label == null && !t.getLabelSet().isEmpty()) {
continue;
}
if ((label == null && t.getLabelSet().isEmpty()) || (label != null && label.matches(t.getLabelSet()))) {
return t;
}
}
return null;
}
开发者ID:iverberk,项目名称:jenkins-nomad,代码行数:12,代码来源:NomadCloud.java
示例20: setUp
import hudson.model.Label; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
node1 = j.createSlave(Label.get("linux"));
node2 = j.createSlave(Label.get("test"));
Disk disk = new Disk(DISK_ID_ONE, null, "mount-from-master", PATH_ON_DISK, null);
DiskPool diskPool = new DiskPool(DISK_POOL_ID, null, null, null, null, null, Collections.singletonList(disk));
setUpDiskPools(j.jenkins, diskPool);
}
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:9,代码来源:WorkspaceCleanupTest.java
注:本文中的hudson.model.Label类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论