当前位置: 首页>>代码示例>>Java>>正文


Java Job.getLastSuccessfulBuild方法代码示例

本文整理汇总了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);
}
 
开发者ID:SxMShaDoW,项目名称:embeddable-badges-plugin,代码行数:48,代码来源:PublicBadgeAction.java

示例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);
    }
}
 
开发者ID:heremaps,项目名称:buildrotator-plugin,代码行数:28,代码来源:BuildRotator.java


注:本文中的hudson.model.Job.getLastSuccessfulBuild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。