/** * 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); }
/** * Gets list of labels for slave */ public void doGetSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String secret) throws IOException { if (!getSwarmSecret().equals(secret)) { rsp.setStatus(SC_FORBIDDEN); return; } Node nn = getNodeByName(name, rsp); if (nn == null) { return; } normalResponse(req, rsp, nn.getLabelString()); }
/** * Remove labels from a slave */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void doRemoveSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String secret, @QueryParameter String labels) throws IOException { if (!getSwarmSecret().equals(secret)) { rsp.setStatus(SC_FORBIDDEN); return; } Node nn = getNodeByName(name, rsp); if (nn == null) { return; } String sCurrentLabels = nn.getLabelString(); List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+")); HashSet<String> hs = new HashSet<>(lCurrentLabels); List<String> lBadLabels = Arrays.asList(labels.split("\\s+")); hs.removeAll(lBadLabels); nn.setLabelString(hashSetToString(hs)); nn.getAssignedLabels(); normalResponse(req, rsp, nn.getLabelString()); }
/** * 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); }
/** * Adds labels to a slave. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void doAddSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String secret, @QueryParameter String labels) throws IOException{ if (!getSwarmSecret().equals(secret)) { rsp.setStatus(SC_FORBIDDEN); return; } Node nn = getNodeByName(name, rsp); if (nn == null) { return; } String sCurrentLabels = nn.getLabelString(); List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+")); HashSet<String> hs = new HashSet<>(lCurrentLabels); List<String> lNewLabels = Arrays.asList(labels.split("\\s+")); hs.addAll(lNewLabels); nn.setLabelString(hashSetToString(hs)); nn.getAssignedLabels(); normalResponse(req, rsp, nn.getLabelString()); }
/** * 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); }
/** * 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); }
continue; if (!this.labelString.equals(node.getLabelString())) { try { LOGGER.log(Level.INFO, "Updating label on node " + instId + " to \"" + this.labelString + "\".");
/** * Returns a list of auto completion candidates. * * @return candidates */ public AutoCompletionCandidates doAutoCompleteLabel() { AutoCompletionCandidates candidates = new AutoCompletionCandidates(); List<Node> masterNodeList = Jenkins.getInstance().getNodes(); for (Node node : masterNodeList) { try { for (LabelAtom atom : Label.parseExpression(node.getLabelString()).listAtoms()) { candidates.add(atom.getName()); } } catch (ANTLRException e) { // invalid expression, skipped } } return candidates; }
Template template = findTemplate(node.getLabelString(), step.getDescriptor().getTemplates());