Ejemplo n.º 1
0
 /** 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;
 }
Ejemplo n.º 2
0
 /** Returns the last failed build, if any. Otherwise null. */
 @Exported
 @QuickSilver
 public RunT getLastFailedBuild() {
   RunT r = getLastBuild();
   while (r != null && (r.isBuilding() || r.getResult() != Result.FAILURE))
     r = r.getPreviousBuild();
   return r;
 }
Ejemplo n.º 3
0
 /**
  * Returns the last stable build, if any. Otherwise null.
  *
  * @see #getLastSuccessfulBuild
  */
 @Exported
 @QuickSilver
 public RunT getLastStableBuild() {
   RunT r = getLastBuild();
   while (r != null && (r.isBuilding() || r.getResult().isWorseThan(Result.SUCCESS)))
     r = r.getPreviousBuild();
   return r;
 }
Ejemplo n.º 4
0
 /**
  * Returns the last unstable build, if any. Otherwise null.
  *
  * @see #getLastSuccessfulBuild
  */
 @Exported
 @QuickSilver
 public RunT getLastUnstableBuild() {
   RunT r = getLastBuild();
   while (r != null && (r.isBuilding() || r.getResult() != Result.UNSTABLE))
     r = r.getPreviousBuild();
   return r;
 }
Ejemplo n.º 5
0
 /**
  * Returns the last build that was anything but stable, if any. Otherwise null.
  *
  * @see #getLastSuccessfulBuild
  */
 @Exported
 @QuickSilver
 public RunT getLastUnsuccessfulBuild() {
   RunT r = getLastBuild();
   while (r != null && (r.isBuilding() || r.getResult() == Result.SUCCESS))
     r = r.getPreviousBuild();
   return r;
 }
Ejemplo n.º 6
0
 /**
  * Returns the last successful build, if any. Otherwise null. A successful build would include
  * either {@link Result#SUCCESS} or {@link Result#UNSTABLE}.
  *
  * @see #getLastStableBuild()
  */
 @Exported
 @QuickSilver
 public RunT getLastSuccessfulBuild() {
   RunT r = getLastBuild();
   // temporary hack till we figure out what's causing this bug
   while (r != null
       && (r.isBuilding() || r.getResult() == null || r.getResult().isWorseThan(Result.UNSTABLE)))
     r = r.getPreviousBuild();
   return r;
 }
Ejemplo n.º 7
0
  /**
   * Returns the last 'numberOfBuilds' builds with a build result >= '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;
  }
Ejemplo n.º 8
0
  @Exported(name = "healthReport")
  public List<HealthReport> getBuildHealthReports() {
    List<HealthReport> reports = new ArrayList<HealthReport>();
    RunT lastBuild = getLastBuild();

    if (lastBuild != null && lastBuild.isBuilding()) {
      // show the previous build's report until the current one is
      // finished building.
      lastBuild = lastBuild.getPreviousBuild();
    }

    // check the cache
    if (cachedBuildHealthReportsBuildNumber != null
        && cachedBuildHealthReports != null
        && lastBuild != null
        && cachedBuildHealthReportsBuildNumber.intValue() == lastBuild.getNumber()) {
      reports.addAll(cachedBuildHealthReports);
    } else if (lastBuild != null) {
      for (HealthReportingAction healthReportingAction :
          lastBuild.getActions(HealthReportingAction.class)) {
        final HealthReport report = healthReportingAction.getBuildHealth();
        if (report != null) {
          if (report.isAggregateReport()) {
            reports.addAll(report.getAggregatedReports());
          } else {
            reports.add(report);
          }
        }
      }
      final HealthReport report = getBuildStabilityHealthReport();
      if (report != null) {
        if (report.isAggregateReport()) {
          reports.addAll(report.getAggregatedReports());
        } else {
          reports.add(report);
        }
      }

      Collections.sort(reports);

      // store the cache
      cachedBuildHealthReportsBuildNumber = lastBuild.getNumber();
      cachedBuildHealthReports = new ArrayList<HealthReport>(reports);
    }

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