mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
add lastUnstableBuild and lastUnsuccessfulBuild permalinks to a job page
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@31329 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
81e1b68c7a
commit
d41634119f
3 files changed
+58
No files matched your search
@@ -790,6 +790,34 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last stable build, if any. Otherwise null.
|
||||
* @see #getLastSuccessfulBuild
|
||||
|
||||
@@ -146,6 +146,34 @@ public interface PermalinkProjectAction extends Action {
|
||||
return job.getLastFailedBuild();
|
||||
}
|
||||
});
|
||||
|
||||
BUILTIN.add(new Permalink() {
|
||||
public String getDisplayName() {
|
||||
return Messages.Permalink_LastUnstableBuild();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return "lastUnstableBuild";
|
||||
}
|
||||
|
||||
public Run<?,?> resolve(Job<?,?> job) {
|
||||
return job.getLastUnstableBuild();
|
||||
}
|
||||
});
|
||||
|
||||
BUILTIN.add(new Permalink() {
|
||||
public String getDisplayName() {
|
||||
return Messages.Permalink_LastUnsuccessfulBuild();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return "lastUnsuccessfulBuild";
|
||||
}
|
||||
|
||||
public Run<?,?> resolve(Job<?,?> job) {
|
||||
return job.getLastUnsuccessfulBuild();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user