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

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(113)

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

Job.getLastBuild介绍

[英]Returns the last build.
[中]返回上一次生成。

代码示例

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

public Run<?,?> resolve(Job<?,?> job) {
    return job.getLastBuild();
  }
};

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

/**
 * Returns true if a build of this project is in progress.
 */
public boolean isBuilding() {
  RunT b = getLastBuild();
  return b!=null && b.isBuilding();
}

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

/**
 * Returns true if the log file is still being updated.
 */
public boolean isLogUpdated() {
  RunT b = getLastBuild();
  return b!=null && b.isLogUpdated();
}

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

private Calendar getLastBuildTime() {
  final RunT lastBuild = getLastBuild();
  if (lastBuild ==null) {
    final GregorianCalendar neverBuiltCalendar = new GregorianCalendar();
    neverBuiltCalendar.setTimeInMillis(0);
    return neverBuiltCalendar;
  }
  return lastBuild.getTimestamp();
}

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

public void doRssLatest( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  List<Run> lastBuilds = new ArrayList<Run>();
  for (TopLevelItem item : getItems()) {
    if (item instanceof Job) {
      Job job = (Job) item;
      Run lb = job.getLastBuild();
      if(lb!=null)    lastBuilds.add(lb);
    }
  }
  RSS.forwardToRss(getDisplayName()+" last builds only", getUrl(),
    lastBuilds, Run.FEED_ADAPTER_LATEST, req, rsp );
}

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

/**
 * Programatically updates the next build number.
 * 
 * <p>
 * Much of Hudson assumes that the build number is unique and monotonic, so
 * this method can only accept a new value that's bigger than
 * {@link #getLastBuild()} returns. Otherwise it'll be no-op.
 * 
 * @since 1.199 (before that, this method was package private.)
 */
public synchronized void updateNextBuildNumber(int next) throws IOException {
  RunT lb = getLastBuild();
  if (lb!=null ?  next>lb.getNumber() : next>0) {
    this.nextBuildNumber = next;
    saveNextBuildNumber();
  }
}

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

/**
 * Returns the last {@code numberOfBuilds} builds with a build result ≥ {@code threshold}
 * 
 * @return a list with the builds. May be smaller than 'numberOfBuilds' or even empty
 *   if not enough builds satisfying the threshold have been found. Never null.
 */
public List<RunT> getLastBuildsOverThreshold(int numberOfBuilds, Result threshold) {
  
  List<RunT> result = new ArrayList<RunT>(numberOfBuilds);
  
  RunT r = getLastBuild();
  while (r != null && result.size() < numberOfBuilds) {
    if (!r.isBuilding() && 
       (r.getResult() != null && r.getResult().isBetterOrEqualTo(threshold))) {
      result.add(r);
    }
    r = r.getPreviousBuild();
  }
  
  return result;
}

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

/**
 * Returns the last completed build, if any. Otherwise null.
 */
@Exported
@QuickSilver
public RunT getLastCompletedBuild() {
  RunT r = getLastBuild();
  while (r != null && r.isBuilding())
    r = r.getPreviousBuild();
  return r;
}

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

/**
 * Used as the color of the status ball for the project.
 */
@Exported(visibility = 2, name = "color")
public BallColor getIconColor() {
  RunT lastBuild = getLastBuild();
  while (lastBuild != null && lastBuild.hasntStartedYet())
    lastBuild = lastBuild.getPreviousBuild();
  if (lastBuild != null)
    return lastBuild.getIconColor();
  else
    return BallColor.NOTBUILT;
}

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

RunT r = getLastBuild();
List<RunT> fallbackCandidates = new ArrayList<RunT>(3);
while (r != null && candidates.size() < 3 && i < 6) {

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

@Exported(name = "healthReport")
public List<HealthReport> getBuildHealthReports() {
  List<HealthReport> reports = new ArrayList<HealthReport>();
  RunT lastBuild = getLastBuild();

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

b = job.getLastBuild();

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

for (RunT r = getLastBuild(); r != null; r = r.getPreviousBuild()) {
  int idx = 0;
  if (r instanceof RunWithSCM) {

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

RunT lB = getLastBuild();
synchronized (this) {
  this.nextBuildNumber = lB != null ? lB.getNumber() + 1 : 1;

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

@Override
public ParameterValue getDefaultParameterValue() {
  if (runId != null) {
    return createValue(runId);
  }
  Run<?,?> lastBuild = null;
  // use getFilter() so we dont have to worry about null filter value.
  switch (getFilter()) {
  case COMPLETED:
    lastBuild = getProject().getLastCompletedBuild();
    break;
  case SUCCESSFUL:
    lastBuild = getProject().getLastSuccessfulBuild();
    break;
  case STABLE	:
    lastBuild = getProject().getLastStableBuild();
    break;
  default:
    lastBuild = getProject().getLastBuild();
    break;
  }
  if (lastBuild != null) {
    return createValue(lastBuild.getExternalizableId());
  } else {
    return null;
  }
}

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

RunT i = getLastBuild();
RunT u = getLastFailedBuild();
if (i != null && u == null) {

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

/**
 * Returns true if the log file is still being updated.
 */
public boolean isLogUpdated() {
  RunT b = getLastBuild();
  return b!=null && b.isLogUpdated();
}

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

private Calendar getLastBuildTime() {
  final RunT lastBuild = getLastBuild();
  if (lastBuild ==null) {
    final GregorianCalendar neverBuiltCalendar = new GregorianCalendar();
    neverBuiltCalendar.setTimeInMillis(0);
    return neverBuiltCalendar;
  }
  return lastBuild.getTimestamp();
}

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

/**
 * Returns true if a build of this project is in progress.
 */
public boolean isBuilding() {
  RunT b = getLastBuild();
  return b!=null && b.isBuilding();
}

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

/**
 * Returns the last completed build, if any. Otherwise null.
 */
@Exported
@QuickSilver
public RunT getLastCompletedBuild() {
  RunT r = getLastBuild();
  while (r != null && r.isBuilding())
    r = r.getPreviousBuild();
  return r;
}

相关文章

微信公众号

最新文章

更多

Job类方法