Java Code Examples for hudson.model.Label#parse()

The following examples show how to use hudson.model.Label#parse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NomadSlaveTemplate.java    From jenkins-nomad with MIT License 6 votes vote down vote up
@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();
}
 
Example 2
Source File: DockerSlaveTemplate.java    From yet-another-docker-plugin with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: DockerTemplate.java    From docker-plugin with MIT License 6 votes vote down vote up
@DataBoundConstructor
public DockerTemplate(@Nonnull DockerTemplateBase dockerTemplateBase,
                      @Nonnull DockerComputerConnector connector,
                      String labelString,
                      String instanceCapStr
) {
    this.dockerTemplateBase = dockerTemplateBase;
    this.connector = connector;
    this.labelString = Util.fixEmpty(labelString);

    if (Strings.isNullOrEmpty(instanceCapStr)) {
        this.instanceCap = Integer.MAX_VALUE;
    } else {
        this.instanceCap = Integer.parseInt(instanceCapStr);
    }

    labelSet = Label.parse(labelString);
}
 
Example 4
Source File: KafkaKubernetesCloud.java    From remoting-kafka-plugin with MIT License 4 votes vote down vote up
public Set<LabelAtom> getLabelSet() {
    return Label.parse(label);
}
 
Example 5
Source File: PodTemplate.java    From kubernetes-plugin with Apache License 2.0 4 votes vote down vote up
public Set<LabelAtom> getLabelSet() {
    return Label.parse(label);
}
 
Example 6
Source File: DockerSlaveTemplate.java    From yet-another-docker-plugin with MIT License 4 votes vote down vote up
@DataBoundSetter
public void setLabelString(String labelString) {
    super.setLabelString(labelString);
    this.labelSet = Label.parse(labelString);
}
 
Example 7
Source File: ECSTaskTemplate.java    From amazon-ecs-plugin with MIT License 4 votes vote down vote up
public Set<LabelAtom> getLabelSet() {
    return Label.parse(label);
}