本文整理了Java中jenkins.model.Jenkins.getSelfLabel()
方法的一些代码示例,展示了Jenkins.getSelfLabel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getSelfLabel()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getSelfLabel
暂无
代码示例来源: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
/**
* Sets the assigned label.
*/
public void setAssignedLabel(Label l) throws IOException {
if(l==null) {
canRoam = true;
assignedNode = null;
} else {
canRoam = false;
if(l== Jenkins.getInstance().getSelfLabel()) assignedNode = null;
else assignedNode = l.getExpression();
}
save();
}
代码示例来源:origin: jenkinsci/jenkins
@Exported
public LoadStatistics getLoadStatistics() {
return LabelAtom.get(nodeName != null ? nodeName : Jenkins.getInstance().getSelfLabel().toString()).loadStatistics;
}
代码示例来源:origin: jenkinsci/jenkins
if (lbl != null && lbl.equals(h.getSelfLabel())) {
if (h.canTake(p) == null) {
return createFlyWeightTaskRunnable(p, h.toComputer());
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
/**
* {@inheritDoc}
*/
@Override
public Label getAssignedLabel() {
Jenkins j = Jenkins.getInstanceOrNull();
if (j == null) {
return null;
}
return j.getSelfLabel();
}
代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-job
@SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="TODO 1.653+ switch to Jenkins.getInstanceOrNull")
@Override public Label getAssignedLabel() {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
return j.getSelfLabel();
}
代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder
/**
* {@inheritDoc}
*/
@Override
public Label getAssignedLabel() {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
return j.getSelfLabel();
}
代码示例来源:origin: jenkinsci/docker-slaves-plugin
@Override public Label getAssignedLabel() {
if (label == null) {
return null;
} else if (label.isEmpty()) {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
return j.getSelfLabel();
} else {
return Label.get(label);
}
}
代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-durable-task-step
@SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="TODO 1.653+ switch to Jenkins.getInstanceOrNull")
@Override public Label getAssignedLabel() {
if (label == null) {
return null;
} else if (label.isEmpty()) {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
return j.getSelfLabel();
} else {
return Label.get(label);
}
}
代码示例来源:origin: io.jenkins.plugins/docker-slaves
@Override public Label getAssignedLabel() {
if (label == null) {
return null;
} else if (label.isEmpty()) {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
return j.getSelfLabel();
} else {
return Label.get(label);
}
}
代码示例来源: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.main/jenkins-core
/**
* Sets the assigned label.
*/
public void setAssignedLabel(Label l) throws IOException {
if(l==null) {
canRoam = true;
assignedNode = null;
} else {
canRoam = false;
if(l== Jenkins.getInstance().getSelfLabel()) assignedNode = null;
else assignedNode = l.getExpression();
}
save();
}
代码示例来源:origin: jenkinsci/parameterized-trigger-plugin
@Override
public Action getAction(AbstractBuild<?, ?> build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException {
Node node = build.getBuiltOn();
Label nodeLabel;
// master does not return a node name so add it explicitly.
if(node == null) {
nodeLabel = Jenkins.getInstance().getSelfLabel();
} else {
nodeLabel = node.getSelfLabel();
}
listener.getLogger().println("Returning node parameter for " + nodeLabel.getDisplayName());
return new NodeAction(nodeLabel);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Exported
public LoadStatistics getLoadStatistics() {
return LabelAtom.get(nodeName != null ? nodeName : Jenkins.getInstance().getSelfLabel().toString()).loadStatistics;
}
代码示例来源:origin: jenkinsci/subversion-plugin
/**
* Manufactures commits by adding files in the given names.
*/
private void createCommit(SubversionSCM scm, String... paths) throws Exception {
FreeStyleProject forCommit = r.createFreeStyleProject();
forCommit.setScm(scm);
forCommit.setAssignedLabel(r.jenkins.getSelfLabel());
FreeStyleBuild b = r.assertBuildStatusSuccess(forCommit.scheduleBuild2(0).get());
SvnClientManager svnm = SubversionSCM.createClientManager((AbstractProject)null);
List<File> added = new ArrayList<>();
for (String path : paths) {
FilePath newFile = b.getWorkspace().child(path);
added.add(new File(newFile.getRemote()));
if (!newFile.exists()) {
newFile.touch(System.currentTimeMillis());
svnm.getWCClient().doAdd(new File(newFile.getRemote()),false,false,false, SVNDepth.INFINITY, false,false);
} else
newFile.write("random content","UTF-8");
}
SVNCommitClient cc = svnm.getCommitClient();
cc.doCommit(added.toArray(new File[added.size()]),false,"added",null,null,false,false,SVNDepth.EMPTY);
}
代码示例来源:origin: jenkinsci/subversion-plugin
/**
* Manufactures commits including metadata
* @return
*/
private void createWorkingCopy(SubversionSCM scm) throws Exception {
FreeStyleProject forCommit = r.createFreeStyleProject();
forCommit.setScm(scm);
forCommit.setAssignedLabel(r.jenkins.getSelfLabel());
FreeStyleBuild b = r.assertBuildStatusSuccess(forCommit.scheduleBuild2(0).get());
workingcopy = b.getWorkspace();
}
代码示例来源:origin: jenkinsci/subversion-plugin
@Test
public void masterPolling() throws Exception {
File repo = new CopyExisting(getClass().getResource("two-revisions.zip")).allocate();
SubversionSCM scm = new SubversionSCM("file://" + repo.toURI().toURL().getPath());
scm.setPollFromMaster(true);
FreeStyleProject p = r.createFreeStyleProject();
p.setScm(scm);
p.setAssignedLabel(r.createSlave().getSelfLabel());
r.assertBuildStatusSuccess(p.scheduleBuild2(2).get());
// initial polling on the master for the code path that doesn't find any change
assertFalse(p.poll(StreamTaskListener.fromStdout()).hasChanges());
// create a commit
FreeStyleProject forCommit = r.createFreeStyleProject();
forCommit.setScm(scm);
forCommit.setAssignedLabel(r.jenkins.getSelfLabel());
FreeStyleBuild b = r.assertBuildStatusSuccess(forCommit.scheduleBuild2(0).get());
FilePath newFile = b.getWorkspace().child("foo");
newFile.touch(System.currentTimeMillis());
SvnClientManager svnm = SubversionSCM.createClientManager(p);
svnm.getWCClient().doAdd(new File(newFile.getRemote()),false,false,false, SVNDepth.INFINITY, false,false);
SVNCommitClient cc = svnm.getCommitClient();
cc.doCommit(new File[]{new File(newFile.getRemote())},false,"added",null,null,false,false,SVNDepth.INFINITY);
// polling on the master for the code path that doesn't find any change
assertTrue(p.poll(StreamTaskListener.fromStdout()).hasChanges());
}
内容来源于网络,如有侵权,请联系作者删除!