本文整理了Java中jenkins.model.Jenkins.getLabel()
方法的一些代码示例,展示了Jenkins.getLabel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getLabel()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getLabel
[英]Gets the label that exists on this system by the name.
[中]按名称获取此系统上存在的标签。
代码示例来源:origin: jenkinsci/jenkins
/**
* Obtains a label by its {@linkplain #getName() name}.
*/
public static Label get(String l) {
return Jenkins.getInstance().getLabel(l);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* 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);
}
代码示例来源:origin: jenkinsci/jenkins
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) {
return Jenkins.getInstance().getLabel(reader.getValue());
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* 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);
}
代码示例来源:origin: jenkinsci/jenkins
Label l = j.getLabel(value);
if (l.isEmpty()) {
for (LabelAtom a : l.listAtoms()) {
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Obtains a label by its {@linkplain #getName() name}.
*/
public static Label get(String l) {
return Jenkins.getInstance().getLabel(l);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) {
return Jenkins.getInstance().getLabel(reader.getValue());
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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);
}
代码示例来源:origin: org.jenkins-ci.plugins/matrix-project
/**
* 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;
}
代码示例来源:origin: org.jenkins-ci.plugins/matrix-project
@Override
public Label getAssignedLabel() {
if (label == null) {
label = computeAssignedLabel();
}
final Jenkins jenkins = Jenkins.getInstance();
return jenkins != null ? jenkins.getLabel(Util.fixEmpty(label)) : null;
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
@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);
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
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();
}
代码示例来源:origin: i-m-c/jenkins-inheritance-plugin
return Jenkins.getInstance().getLabel(
'"' + lbl.getName() + '"'
);
代码示例来源:origin: i-m-c/jenkins-inheritance-plugin
return Jenkins.getInstance().getLabel(
'"' + lbl.getName() + '"'
);
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
Label l = j.getLabel(value);
if (l.isEmpty()) {
for (LabelAtom a : l.listAtoms()) {
代码示例来源:origin: groupon/DotCi
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);
}
}
内容来源于网络,如有侵权,请联系作者删除!