Class RecentRuns

java.lang.Object
hudson.model.listeners.RunListener<Run<?,?>>
jenkins.model.dashboard.RecentRuns
All Implemented Interfaces:
ExtensionPoint

@Extension @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class RecentRuns extends RunListener<Run<?,?>>
Remembers the last completed build of every job, for RecentTab.

Each job has one entry, so a few busy jobs cannot push out everything else, and users who can only see a few jobs still find their recent builds however busy the rest of the instance is. Like Job.getLastCompletedBuild(), the entry is the job's highest-numbered completed build, also when builds complete out of order. Runs are held by job full name and build number rather than by reference, so this does not keep builds in memory, and an entry takes about a hundred bytes. The index starts empty. The first read fills it in the background from each job's last completed build, so startup does not load any builds.

  • Constructor Details

    • RecentRuns

      public RecentRuns()
  • Method Details

    • get

      public static RecentRuns get()
    • onCompleted

      public void onCompleted(Run<?,?> run, @NonNull TaskListener listener)
      Description copied from class: RunListener
      Called after a build is completed.
      Overrides:
      onCompleted in class RunListener<Run<?,?>>
      Parameters:
      run - The completed build.
      listener - The listener for this build. This can be used to produce log messages, for example, which becomes a part of the "console output" of this build. But when this method runs, the build is considered completed, so its status cannot be changed anymore.
    • onDeleted

      public void onDeleted(Run<?,?> run)
      Description copied from class: RunListener
      Called right before a build is going to be deleted.
      Overrides:
      onDeleted in class RunListener<Run<?,?>>
      Parameters:
      run - The build.
    • getCompleted

      @NonNull public List<Run<?,?>> getCompleted(int limit)
      The most recently completed runs that the current user can see, newest first, one per job.
      Parameters:
      limit - the maximum number of runs to return