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


Java AbstractBuild.getResult方法代码示例

本文整理汇总了Java中hudson.model.AbstractBuild.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractBuild.getResult方法的具体用法?Java AbstractBuild.getResult怎么用?Java AbstractBuild.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.model.AbstractBuild的用法示例。


在下文中一共展示了AbstractBuild.getResult方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: perform

import hudson.model.AbstractBuild; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) {

    Result result = build.getResult();

    if (Result.SUCCESS != result) {
        listener.getLogger().println("Previous steps failed the build.\nResult is: " + result);

        return false;
    }

    boolean buildPassed;

    try {
        JobConfigData checkedJobConfigData = jobConfigurationService.checkProjectKeyIfVariable(jobConfigData, build, listener);
        buildPassed = buildDecision.getStatus(globalConfigDataForSonarInstance, checkedJobConfigData, listener);

        if ("".equals(jobConfigData.getSonarInstanceName())) {
            listener.getLogger().println(JobExecutionService.DEFAULT_CONFIGURATION_WARNING);
        }

        listener.getLogger().println("PostBuild-Step: Quality Gates plugin build passed: " + String.valueOf(buildPassed).toUpperCase());

        return buildPassed;
    } catch (QGException e) {
        e.printStackTrace(listener.getLogger());
    }

    return false;
}
 
开发者ID:jenkinsci,项目名称:sonar-quality-gates-plugin,代码行数:31,代码来源:QGPublisher.java

示例2: onCompleted

import hudson.model.AbstractBuild; //导入方法依赖的package包/类
@Override
public void onCompleted(AbstractBuild builder, @Nonnull TaskListener listener) {

    Result result = builder.getResult();
    if (null != result && result.equals(Result.SUCCESS)) {
        getService(builder, listener).success();
    } else {
        getService(builder, listener).failed();
    }
}
 
开发者ID:wanyukang,项目名称:custom-notifier-plugin,代码行数:11,代码来源:JobListener.java

示例3: completed

import hudson.model.AbstractBuild; //导入方法依赖的package包/类
public void completed(AbstractBuild r) {
    AbstractProject<?, ?> project = r.getProject();
    if(project == null) return;
    Result result = r.getResult();
    AbstractBuild<?, ?> previousBuild = project.getLastBuild();
    if(previousBuild == null) return;
    do {
        previousBuild = previousBuild.getPreviousCompletedBuild();
    } while (previousBuild != null && previousBuild.getResult() == Result.ABORTED);
    Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS;
    if ((result == Result.ABORTED && notifier.getNotifyAborted())
            || (result == Result.FAILURE //notify only on single failed build
                && previousResult != Result.FAILURE
                && notifier.getNotifyFailure())
            || (result == Result.FAILURE //notify only on repeated failures
                && previousResult == Result.FAILURE
                && notifier.getNotifyRepeatedFailure())
            || (result == Result.NOT_BUILT && notifier.getNotifyNotBuilt())
            || (result == Result.SUCCESS
                && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE)
                && notifier.getNotifyBackToNormal())
            || (result == Result.SUCCESS && notifier.getNotifySuccess())
            || (result == Result.UNSTABLE && notifier.getNotifyUnstable())) {
        getTelegram(r).publish(getBuildStatusMessage(r, notifier.includeTestSummary(),
                notifier.getIncludeFailedTests(),notifier.includeCustomMessage()), getBuildColor(r));

    }
}
 
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:29,代码来源:ActiveNotifier.java

示例4: getBuildColor

import hudson.model.AbstractBuild; //导入方法依赖的package包/类
static String getBuildColor(AbstractBuild r) {
    Result result = r.getResult();
    if (result == Result.SUCCESS) {
        return "good";
    } else if (result == Result.FAILURE) {
        return "danger";
    } else {
        return "warning";
    }
}
 
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:11,代码来源:ActiveNotifier.java

示例5: perform

import hudson.model.AbstractBuild; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws UnsupportedEncodingException {

    logger = listener.getLogger();

    Jenkins.getInstance();
    String jobURL = "";
    try {
        jobURL = build.getEnvironment(listener).expand("${JOB_URL}");
        logger.println("jobURL = " + jobURL);
    } catch (Exception e) {
        logger.println("tokenmacro expand error.");
    }

    String msg = "各位小伙伴,项目";
    msg += build.getFullDisplayName();
    if (build.getResult() == Result.SUCCESS) {
        msg += "编译成功!" + qqmessage;
    } else {
        msg += "编译失败了...";
        msg += "jenkins地址:" + jobURL;
    }

    msg = URLEncoder.encode(msg, "UTF-8");
    msg = msg.replaceAll("\\+", "_");

    for (int i = 0; i < qQNumbers.size(); i++) {
        QQNumber number = qQNumbers.get(i);
        send(GenerateMessageURL(number.GetUrlString(), msg));
    }

    return true;
}
 
开发者ID:ameizi,项目名称:NotifyQQ,代码行数:34,代码来源:NotifyQQ.java

示例6: getBuildStatus

import hudson.model.AbstractBuild; //导入方法依赖的package包/类
static MessageStatus getBuildStatus(AbstractBuild r){
    if (r.isBuilding()) {
        return MessageStatus.STARTING;
    }
    Run previousSuccessfulBuild = null;
    Run previousBuild = null;
    Result result = r.getResult();
    Result previousResult;
    try {
        previousBuild = r.getProject().getLastBuild().getPreviousBuild();
        previousSuccessfulBuild = r.getPreviousSuccessfulBuild();
    }catch (NullPointerException npe){
       return MessageStatus.UNKNOWN;
    }

    boolean buildHasSucceededBefore = previousSuccessfulBuild != null;

    /*
     * If the last build was aborted, go back to find the last non-aborted build.
     * This is so that aborted builds do not affect build transitions.
     * I.e. if build 1 was failure, build 2 was aborted and build 3 was a success the transition
     * should be failure -> success (and therefore back to normal) not aborted -> success.
     */
    Run lastNonAbortedBuild = previousBuild;
    while(lastNonAbortedBuild != null && lastNonAbortedBuild.getResult() == Result.ABORTED) {
        lastNonAbortedBuild = lastNonAbortedBuild.getPreviousBuild();
    }


    /* If all previous builds have been aborted, then use
     * SUCCESS as a default status so an aborted message is sent
     */
    if(lastNonAbortedBuild == null) {
        previousResult = Result.SUCCESS;
    } else {
        previousResult = lastNonAbortedBuild.getResult();
    }

    /* Back to normal should only be shown if the build has actually succeeded at some point.
     * Also, if a build was previously unstable and has now succeeded the status should be
     * "Back to normal"
     */
    if (result == Result.SUCCESS
            && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE)
            && buildHasSucceededBefore) {
        return MessageStatus.BACK_TO_NORMAL;
    }
    if (result == Result.FAILURE && previousResult == Result.FAILURE) {
        return MessageStatus.STILL_FAILING;
    }
    if (result == Result.SUCCESS) {
        return MessageStatus.SUCCESS;
    }
    if (result == Result.FAILURE) {
        return MessageStatus.FAILURE;
    }
    if (result == Result.ABORTED) {
        return MessageStatus.ABORTED;
    }
    if (result == Result.NOT_BUILT) {
        return MessageStatus.NOT_BUILT;
    }
    if (result == Result.UNSTABLE) {
        return MessageStatus.UNSTABLE;
    }
    return MessageStatus.UNKNOWN;
}
 
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:68,代码来源:ActiveNotifier.java


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