/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a agent * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
/** * Initializes data structure that we don't persist. * @return The initialized object. */ protected Object readResolve() { labelSet = Label.parse(labelString); return this; }
public Set<LabelAtom> getLabelSet() { return Label.parse(label); }
public Set<LabelAtom> getLabelSet() { return Label.parse(label); }
@DataBoundConstructor public DockerTemplate(@Nonnull DockerTemplateBase dockerTemplateBase, DockerComputerConnector connector, String labelString, String instanceCapStr ) { this.dockerTemplateBase = dockerTemplateBase; this.connector = connector; this.labelString = Util.fixNull(labelString); if (Strings.isNullOrEmpty(instanceCapStr)) { this.instanceCap = Integer.MAX_VALUE; } else { this.instanceCap = Integer.parseInt(instanceCapStr); } labelSet = Label.parse(labelString); }
@Override public boolean canProvision(final Label label) { boolean result = fleet != null && (label == null || Label.parse(this.labelString).containsAll(label.listAtoms())); LOGGER.log(Level.FINE, "CanProvision called on fleet: \"" + this.labelString + "\" wanting: \"" + (label == null ? "(unspecified)" : label.getName()) + "\". Returning " + Boolean.toString(result) + "."); return result; }
@DataBoundSetter public void setLabelString(String labelString) { super.setLabelString(labelString); this.labelSet = Label.parse(labelString); }
public Label getMagicNodeLabelForTestingValue() { String str = this.getMagicNodeLabelForTesting(); if (str == null) { return null; } Set<LabelAtom> nonTestSet = Label.parse(str); Label out = null; for (LabelAtom la : nonTestSet) { out = (out == null) ? la : out.and(la); } return out; }
/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a slave * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a slave * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a agent * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
private Object readResolve() { labelDataSet = Label.parse(labels); templateProvisionStrategy = new ProvisionStrategy();
/** * 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; }
/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a slave * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a slave * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
/** * 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; }
/** * Initializes data structure that we don't persist. */ public Object readResolve() { try { // https://github.com/jenkinsci/docker-plugin/issues/270 if (configVersion < 2) { if (retentionStrategy instanceof DockerOnceRetentionStrategy) { DockerOnceRetentionStrategy tmpStrategy = (DockerOnceRetentionStrategy) retentionStrategy; if (tmpStrategy.getIdleMinutes() == 0) { setRetentionStrategy(new DockerOnceRetentionStrategy(10)); } } configVersion = 2; } else { configDefaults(); } try { labelSet = Label.parse(labelString); // fails sometimes under debugger } catch (Throwable t) { LOGGER.error("Can't parse labels: ", t); } if (connector == null && launcher != null) { connector = launcher.convertToConnector(); } } catch (Throwable t) { LOGGER.error("Can't convert old values to new (double conversion?): ", t); } return this; }
/** * Check if the label in the slave matches the provided label, either both are null or are the same. * * @param label * @return Whether the slave label matches. */ public boolean matchesLabel(@CheckForNull Label label) { if (label == null || getLabelString() == null) { return label == null && getLabelString() == null; } if (label.matches(Label.parse(getLabelString()))) { return true; } if (containerInfo == null || !containerInfo.getDockerImageCustomizable()) { return false; } String customImage = getCustomImage(label); return customImage != null && getLabelWithoutCustomImage(label, customImage).matches(Label.parse(getLabelString())); }
/** * Initializes data structure that we don't persist. */ protected Object readResolve() { Jenkins.getInstance().checkPermission(Jenkins.RUN_SCRIPTS); 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, slaveCommandPrefix, slaveCommandSuffix, sshPort); } return this; }
public MesosSlaveInfo getMesosSlaveInfoForLabel(Label label) { if (!matchesLabel(label)) { return null; } if (label == null) { if (getLabelString() == null) { return this; } else { return null; } } if (label.matches(Label.parse(getLabelString()))) { return this; } if (!containerInfo.getDockerImageCustomizable()) { return null; } String customImage = getCustomImage(label); if (customImage == null) { return null; } return copyWithDockerImage(label.toString(), customImage); }