本文整理汇总了Java中hudson.model.Job.getLastSuccessfulBuild方法的典型用法代码示例。如果您正苦于以下问题:Java Job.getLastSuccessfulBuild方法的具体用法?Java Job.getLastSuccessfulBuild怎么用?Java Job.getLastSuccessfulBuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Job
的用法示例。
在下文中一共展示了Job.getLastSuccessfulBuild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCoverageIcon
import hudson.model.Job; //导入方法依赖的package包/类
/**
* Serves the codeCoverage badge image.
*
* @param req
* @param rsp
* @param job
* @return
*/
public HttpResponse doCoverageIcon(StaplerRequest req, StaplerResponse rsp, @QueryParameter String job) {
Job<?, ?> project = getProject(job);
Integer codeCoverage = null;
if (project.getLastSuccessfulBuild() != null) {
PluginWrapper jacocoInstalled = getInstance().pluginManager.getPlugin("jacoco");
// Checks for Jacoco
if (jacocoInstalled != null && jacocoInstalled.isActive()) {
JacocoBuildAction jacocoAction = project.getLastSuccessfulBuild().getAction(JacocoBuildAction.class);
if (jacocoAction != null) {
if (jacocoAction.getInstructionCoverage() != null){
codeCoverage = jacocoAction.getInstructionCoverage().getPercentage();
}
}
}
PluginWrapper coberturaInstalled = getInstance().pluginManager.getPlugin("cobertura");
// Checks for Cobertura
if (coberturaInstalled != null && coberturaInstalled.isActive()) {
CoberturaBuildAction coverageAction = project.getLastSuccessfulBuild().getAction(CoberturaBuildAction.class);
if (coverageAction != null) {
if (coverageAction.getBuildHealth() != null){
codeCoverage = coverageAction.getResults().get(CoverageMetric.LINE).getPercentage();
}
}
}
PluginWrapper cloverInstalled = getInstance().pluginManager.getPlugin("clover");
// Checks for Clover
if (cloverInstalled != null && cloverInstalled.isActive()) {
CloverBuildAction cloverAction = project.getLastSuccessfulBuild().getAction(CloverBuildAction.class);
if (cloverAction != null){
if (cloverAction.getBuildHealth() != null){
codeCoverage = cloverAction.getElementCoverage().getPercentage();
}
}
}
}
return iconResolver.getCoverageImage(codeCoverage);
}
示例2: perform
import hudson.model.Job; //导入方法依赖的package包/类
@Override
public void perform(Job<?, ?> job) throws IOException, InterruptedException {
LOGGER.log(FINE, "Running the log rotation for {0} with numToKeep={1} " +
"daysToKeep={2} " +
"artifactsNumToKeep={3} " +
"artifactsDaysToKeep={4}", new Object[]{job, numToKeep, daysToKeep, artifactsNumToKeep, artifactsDaysToKeep});
// always keep the last successful and the last stable builds
final Run lastSuccessfulBuild = job.getLastSuccessfulBuild();
final Run lastStableBuild = job.getLastStableBuild();
if (numToKeep != -1) {
removeByNumber(job, lastSuccessfulBuild, lastStableBuild, Action.DELETE_BUILD);
}
if (daysToKeep != -1) {
removeByDate(job, lastSuccessfulBuild, lastStableBuild, Action.DELETE_BUILD);
}
if (artifactsNumToKeep != -1) {
removeByNumber(job, lastSuccessfulBuild, lastStableBuild, Action.DELETE_ARTIFACT);
}
if (artifactsDaysToKeep != -1) {
removeByDate(job, lastSuccessfulBuild, lastStableBuild, Action.DELETE_ARTIFACT);
}
}