hudson.model.AbstractProject.getLastBuild()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中hudson.model.AbstractProject.getLastBuild()方法的一些代码示例,展示了AbstractProject.getLastBuild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractProject.getLastBuild()方法的具体详情如下:
包路径:hudson.model.AbstractProject
类名称:AbstractProject
方法名:getLastBuild

AbstractProject.getLastBuild介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the {@link Node} where this project was last built on.
 *
 * @return
 *      null if no information is available (for example,
 *      if no build was done yet.)
 */
public Node getLastBuiltOn() {
  // where was it built on?
  AbstractBuild b = getLastBuild();
  if(b==null)
    return null;
  else
    return b.getBuiltOn();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns true if this user has made a commit to this project.
 *
 * @since 1.191
 */
public boolean hasParticipant(User user) {
  for( R build = getLastBuild(); build!=null; build=build.getPreviousBuild())
    if(build.hasParticipant(user))
      return true;
  return false;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets some build that has a live workspace.
 *
 * @return null if no such build exists.
 */
public final R getSomeBuildWithWorkspace() {
  int cnt=0;
  for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
    FilePath ws = b.getWorkspace();
    if (ws!=null)   return b;
  }
  return null;
}

代码示例来源:origin: jenkinsci/jenkins

private R getSomeBuildWithExistingWorkspace() throws IOException, InterruptedException {
  int cnt=0;
  for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
    FilePath ws = b.getWorkspace();
    if (ws!=null && ws.exists())   return b;
  }
  return null;
}

代码示例来源:origin: jenkinsci/jenkins

public void doRssLatest(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  final List<Run> lastBuilds = new ArrayList<>();
  for (AbstractProject<?, ?> p : Jenkins.get().allItems(AbstractProject.class)) {
    for (AbstractBuild<?, ?> b = p.getLastBuild(); b != null; b = b.getPreviousBuild()) {
      if (relatedTo(b)) {
        lastBuilds.add(b);
        break;
      }
    }
  }
  // historically these have been reported sorted by project name, we switched to the lazy iteration
  // so we only have to sort the sublist of runs rather than the full list of irrelevant projects
  lastBuilds.sort((o1, o2) -> Items.BY_FULL_NAME.compare(o1.getParent(), o2.getParent()));
  rss(req, rsp, " latest build", RunList.fromRuns(lastBuilds), Run.FEED_ADAPTER_LATEST);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Various deprecated methods in this class all need the 'current' build.  This method returns
 * the build suitable for that purpose.
 *
 * @return An AbstractBuild for deprecated methods to use.
 */
private AbstractBuild getBuildForDeprecatedMethods() {
  Executor e = Executor.currentExecutor();
  if(e!=null) {
    Executable exe = e.getCurrentExecutable();
    if (exe instanceof AbstractBuild) {
      AbstractBuild b = (AbstractBuild) exe;
      if(b.getProject()==this)
        return b;
    }
  }
  R lb = getLastBuild();
  if(lb!=null)    return lb;
  return null;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Convenience method for the caller to handle the backward compatibility between pre 1.345 SCMs.
 */
public final PollingResult poll(AbstractProject<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException {
  if (is1_346OrLater()) {
    // This is to work around HUDSON-5827 in a general way.
    // don't let the SCM.compareRemoteRevisionWith(...) see SCMRevisionState that it didn't produce.
    SCMRevisionState baseline2;
    if (baseline!=SCMRevisionState.NONE) {
      baseline2 = baseline;
    } else {
      baseline2 = calcRevisionsFromBuild(project.getLastBuild(), launcher, listener);
    }
    return compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2);
  } else {
    return pollChanges(project,launcher,workspace,listener) ? PollingResult.SIGNIFICANT : PollingResult.NO_CHANGES;
  }
}

代码示例来源:origin: jenkinsci/jenkins

if (scm.requiresWorkspaceForPolling()) {
  R b = getSomeBuildWithExistingWorkspace();
  if (b == null) b = getLastBuild();
    calcPollingBaseline(getLastBuild(),null,listener);
  PollingResult r = scm.poll(this, null, null, listener, pollingBaseline);
  pollingBaseline = r.remote;

代码示例来源:origin: jenkinsci/jenkins

R lb = getLastBuild();
if (lb==null) {
  listener.getLogger().println(Messages.AbstractProject_NoBuilds());

代码示例来源:origin: jenkinsci/jenkins

final R lastBuild = getLastBuild();
if (lastBuild != null) {
  return new BlockedBecauseOfBuildInProgress(lastBuild);

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Returns whether this build is the last available build.
 *
 * @return <code>true</code> if this build is the last available build
 */
public final boolean isCurrent() {
  return owner.getProject().getLastBuild().number == owner.number;
}

代码示例来源:origin: org.hudsonci.plugins/disk-usage

public BuildDiskUsageAction getLastBuildAction() {
  Run run = project.getLastBuild();
  if (run != null) {
    return run.getAction(BuildDiskUsageAction.class);
  }
  return null;
}

代码示例来源:origin: org.jenkins-ci.plugins/disk-usage

public BuildDiskUsageAction getLastBuildAction() {
  Run run = project.getLastBuild();
  if (run != null) {
    return run.getAction(BuildDiskUsageAction.class);
  }
  return null;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Returns true if this user has made a commit to this project.
 *
 * @since 1.191
 */
public boolean hasParticipant(User user) {
  for( R build = getLastBuild(); build!=null; build=build.getPreviousBuild())
    if(build.hasParticipant(user))
      return true;
  return false;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Gets some build that has a live workspace.
 *
 * @return null if no such build exists.
 */
public final R getSomeBuildWithWorkspace() {
  int cnt=0;
  for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
    FilePath ws = b.getWorkspace();
    if (ws!=null)   return b;
  }
  return null;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Returns true if this user has made a commit to this project.
 *
 * @since 1.191
 */
public boolean hasParticipant(User user) {
  for( R build = getLastBuild(); build!=null; build=build.getPreviousBuild())
    if(build.hasParticipant(user))
      return true;
  return false;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private R getSomeBuildWithExistingWorkspace() throws IOException, InterruptedException {
  int cnt=0;
  for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
    FilePath ws = b.getWorkspace();
    if (ws!=null && ws.exists())   return b;
  }
  return null;
}

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Returns whether this result belongs to the last build.
 *
 * @return <code>true</code> if this result belongs to the last build
 */
public boolean isCurrent() {
  return getOwner().getProject().getLastBuild().number == getOwner().number;
}

代码示例来源:origin: org.jvnet.hudson.plugins/testng-plugin

/**
* {@inheritDoc}
*/
public String getIconFileName() {
 for (AbstractBuild<?, ?> build = getProject().getLastBuild(); build != null; build = build.getPreviousBuild()) {
   final AbstractBuildAction action = build.getAction(getBuildActionClass());
   if (action != null) {
    return PluginImpl.ICON_FILE_NAME;
   }
 }
 return null;
}

代码示例来源:origin: org.jvnet.hudson.plugins/testng-plugin

protected void populateDataSetBuilder(DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> dataset) {
 for (AbstractBuild<?, ?> build = getProject().getLastBuild(); build != null; build = build.getPreviousBuild()) {
   ChartUtil.NumberOnlyBuildLabel label = new ChartUtil.NumberOnlyBuildLabel(build);
   AbstractBuildAction action = build.getAction(getBuildActionClass());
   if (action != null) {
    dataset.add(action.getResults().getPassedTestCount(), "Passed", label);
    dataset.add(action.getResults().getFailedTestCount(), "Failed", label);
    dataset.add(action.getResults().getSkippedTestCount(), "Skipped", label);
   }
 }
}

相关文章

微信公众号

最新文章

更多

AbstractProject类方法