/** * Obtains a label by its {@linkplain #getName() name}. */ public static Label get(String l) { return Jenkins.getInstance().getLabel(l); }
/** * Checks whether this installer can be applied to a given node. * (By default, just checks the label.) */ public boolean appliesTo(Node node) { Label l = Jenkins.getInstance().getLabel(label); return l == null || l.contains(node); }
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) { return Jenkins.getInstance().getLabel(reader.getValue()); } }
/** * If this project is configured to be always built on this node, * return that {@link Node}. Otherwise null. */ public @CheckForNull Label getAssignedLabel() { if(canRoam) return null; if(assignedNode==null) return Jenkins.getInstance().getSelfLabel(); return Jenkins.getInstance().getLabel(assignedNode); }
Label l = j.getLabel(value); if (l.isEmpty()) { for (LabelAtom a : l.listAtoms()) {
/** * Obtains a label by its {@linkplain #getName() name}. */ public static Label get(String l) { return Jenkins.getInstance().getLabel(l); }
/** * Checks whether this installer can be applied to a given node. * (By default, just checks the label.) */ public boolean appliesTo(Node node) { Label l = Jenkins.getInstance().getLabel(label); return l == null || l.contains(node); }
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) { return Jenkins.getInstance().getLabel(reader.getValue()); } }
/** * If this project is configured to be always built on this node, * return that {@link Node}. Otherwise null. */ public @CheckForNull Label getAssignedLabel() { if(canRoam) return null; if(assignedNode==null) return Jenkins.getInstance().getSelfLabel(); return Jenkins.getInstance().getLabel(assignedNode); }
/** * Gets the {@link Label}s where the builds will be run. * @return never null */ public @Nonnull Set<Label> getLabels() { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { return Collections.emptySet(); } Set<Label> r = new HashSet<Label>(); for (Combination c : axes.subList(LabelAxis.class).list()) r.add(jenkins.getLabel(Util.join(c.values(),"&&"))); return r; }
@Override public Label getAssignedLabel() { if (label == null) { label = computeAssignedLabel(); } final Jenkins jenkins = Jenkins.getInstance(); return jenkins != null ? jenkins.getLabel(Util.fixEmpty(label)) : null; }
@Override public Label getAssignedLabel() { // Really would like to run on the exact node that the promoted build ran on, // not just the same label.. but at least this works if job is tied to one node: if (assignedLabel == null) return getOwner().getAssignedLabel(); return JenkinsHelper.getInstance().getLabel(assignedLabel); }
public FormValidation doCheckLabelString(@QueryParameter String value) { if (Util.fixEmpty(value)==null) return FormValidation.ok(); // nothing typed yet try { Label.parseExpression(value); } catch (ANTLRException e) { return FormValidation.error(e, Messages.JobPropertyImpl_LabelString_InvalidBooleanExpression(e.getMessage())); } // TODO: if there's an atom in the expression that is empty, report it if (JenkinsHelper.getInstance().getLabel(value).isEmpty()) return FormValidation.warning(Messages.JobPropertyImpl_LabelString_NoMatch()); return FormValidation.ok(); }
return Jenkins.getInstance().getLabel( '"' + lbl.getName() + '"' );
return Jenkins.getInstance().getLabel( '"' + lbl.getName() + '"' );
Label l = j.getLabel(value); if (l.isEmpty()) { for (LabelAtom a : l.listAtoms()) {
public DynamicProject createNewProject(final GHRepository githubRepository, final String accessToken, final String user) { try { new GithubRepositoryService(githubRepository).linkProjectToCi(accessToken, user); final OrganizationContainer folder = this.organizationRepository.getOrCreateContainer(githubRepository.getOwner().getLogin()); final String projectName = githubRepository.getName(); final DynamicProject project = folder.createProject(DynamicProject.class, projectName); project.setDescription(format("<a href=\"%s\">%s</a>", githubRepository.getUrl(), githubRepository.getUrl())); project.setConcurrentBuild(true); if (StringUtils.isNotEmpty(SetupConfig.get().getLabel())) { project.setAssignedLabel(Jenkins.getInstance().getLabel(SetupConfig.get().getLabel())); } project.addProperty(new ParametersDefinitionProperty(new GithubBranchParameterDefinition("BRANCH", "master", githubRepository.getHtmlUrl().toString()))); project.addProperty(new GithubRepoProperty(githubRepository.getHtmlUrl().toExternalForm())); project.addProperty(new BuildTypeProperty(SetupConfig.get().getDefaultBuildType())); project.addProperty(new DynamicProjectBranchTabsProperty("master")); project.addProperty(new RebuildSettings(true, false)); project.addProperty(new JobUiProperty(SetupConfig.get().isDefaultToNewUi())); project.save(); folder.addItem(project); folder.save(); return project; } catch (final IOException e) { throw new RuntimeException(e); } }