提交 d4163411 编写于 作者: M mcrooney

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
上级 81e1b68c
......@@ -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();
}
});
}
}
}
......@@ -232,6 +232,8 @@ UpdateCenter.PluginCategory.unrecognized=Misc ({0})
Permalink.LastBuild=Last build
Permalink.LastStableBuild=Last stable build
Permalink.LastUnstableBuild=Last unstable build
Permalink.LastUnsuccessfulBuild=Last unsuccessful build
Permalink.LastSuccessfulBuild=Last successful build
Permalink.LastFailedBuild=Last failed build
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册