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


Java GHCommitState.FAILURE属性代码示例

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


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

示例1: statusOf

private static GHCommitState statusOf(StageExecution stageExecution) {
    if (stageExecution.isSuccessful()) {
        return GHCommitState.SUCCESS;
    } else if (Iterables.any(stageExecution.getBuilds(), new Predicate<BuildExecution>() {
        @Override
        public boolean apply(BuildExecution input) {
            return input.getBuildState() == BuildState.UNKNOWN;
        }
    })) {
        return GHCommitState.ERROR;
    } else {
        return GHCommitState.FAILURE;
    }
}
 
开发者ID:HackAttack,项目名称:bamboo-github-status,代码行数:14,代码来源:GitHubStatusPostStage.java

示例2: getState

GHCommitState getState(String result) {
    result = result == null ? "" : result;
    GHCommitState state = GHCommitState.PENDING;
    if (result.equalsIgnoreCase("Passed")) {
        state = GHCommitState.SUCCESS;
    } else if (result.equalsIgnoreCase("Failed")) {
        state = GHCommitState.FAILURE;
    } else if (result.equalsIgnoreCase("Cancelled")) {
        state = GHCommitState.ERROR;
    }
    return state;
}
 
开发者ID:gocd-contrib,项目名称:gocd-build-status-notifier,代码行数:12,代码来源:GitHubProvider.java

示例3: getCommitState

public static GHCommitState getCommitState(final Run<?, ?> run, final GHCommitState unstableAs) {
    GHCommitState state;
    Result result = run.getResult();
    if (isNull(result)) {
        LOG.error("{} result is null.", run);
        state = GHCommitState.ERROR;
    } else if (result.isBetterOrEqualTo(SUCCESS)) {
        state = GHCommitState.SUCCESS;
    } else if (result.isBetterOrEqualTo(UNSTABLE)) {
        state = unstableAs;
    } else {
        state = GHCommitState.FAILURE;
    }
    return state;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:15,代码来源:JobHelper.java

示例4: doFillUnstableAsItems

@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillUnstableAsItems() {
    ListBoxModel items = new ListBoxModel();
    GHCommitState[] results = new GHCommitState[] {GHCommitState.SUCCESS,GHCommitState.ERROR,GHCommitState.FAILURE};
    for (GHCommitState nextResult : results) {
        String text = StringUtils.capitalize(nextResult.toString().toLowerCase());
        items.add(text, nextResult.toString());
        if (unstableAs.toString().equals(nextResult)) {
            items.get(items.size()-1).selected = true;
        }
    }

    return items;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:14,代码来源:GhprcTrigger.java

示例5: doFillResultItems

public ListBoxModel doFillResultItems(@QueryParameter String result) {
    ListBoxModel items = new ListBoxModel();
    GHCommitState[] results = new GHCommitState[] { GHCommitState.SUCCESS, GHCommitState.ERROR, GHCommitState.FAILURE };
    for (GHCommitState nextResult : results) {

        items.add(nextResult.toString(), nextResult.toString());
        if (result.toString().equals(nextResult)) {
            items.get(items.size() - 1).selected = true;
        }
    }

    return items;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:13,代码来源:GhprcBuildResultMessage.java

示例6: onCompleted

public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) {
    GhprcCause c = Ghprc.getCause(build);
    if (c == null) {
        return;
    }

    // remove the BuildData action that we may have added earlier to avoid
    // having two of them, and because the one we added isn't correct
    // @see GhprcTrigger
    BuildData fakeOne = null;
    for (BuildData data : build.getActions(BuildData.class)) {
        if (data.getLastBuiltRevision() != null && !data.getLastBuiltRevision().getSha1String().equals(c.getCommit())) {
            fakeOne = data;
            break;
        }
    }
    if (fakeOne != null) {
        build.getActions().remove(fakeOne);
    }

    for (GhprcExtension ext : Ghprc.getJobExtensions(trigger, GhprcCommitStatus.class)) {
        if (ext instanceof GhprcCommitStatus) {
            try {
                ((GhprcCommitStatus) ext).onBuildComplete(build, listener, repo.getGitHubRepo());
            } catch (GhprcCommitStatusException e) {
                repo.commentOnFailure(build, listener, e);
            }
        }
    }

    GHCommitState state;
    state = Ghprc.getState(build);

    commentOnBuildResult(build, listener, c);
    // close failed pull request automatically
    if (state == GHCommitState.FAILURE && trigger.isAutoCloseFailedPullRequests()) {
        closeFailedRequest(listener, c);
    }
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:39,代码来源:GhprcBuilds.java

示例7: getState

public static GHCommitState getState(AbstractBuild<?, ?> build) {

        GHCommitState state;
        if (build.getResult() == Result.SUCCESS) {
            state = GHCommitState.SUCCESS;
        } else if (build.getResult() == Result.UNSTABLE) {
            state = GhprcTrigger.getDscp().getUnstableAs();
        } else {
            state = GHCommitState.FAILURE;
        }
        return state;
    }
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:12,代码来源:Ghprc.java

示例8: onCompleted

@Override
public void onCompleted(final DynamicBuild build, final TaskListener listener) {
    final String sha1 = build.getSha();
    if (sha1 == null) {
        return;
    }

    final GHRepository repository = getGithubRepository(build);
    final GHCommitState state;
    String msg;
    final Result result = build.getResult();
    if (result.isBetterOrEqualTo(SUCCESS)) {
        state = GHCommitState.SUCCESS;
        msg = "Success";
    } else if (result.isBetterOrEqualTo(UNSTABLE)) {
        state = GHCommitState.FAILURE;
        msg = "Unstable";
    } else {
        state = GHCommitState.FAILURE;
        msg = "Failed";
    }
    if (build.isSkipped()) {
        msg += " - Skipped";
    }
    try {
        listener.getLogger().println("setting commit status on Github for " + repository.getHtmlUrl() + "/commit/" + sha1);
        repository.createCommitStatus(sha1, state, build.getFullUrl(), msg, getContext(build));
    } catch (final Exception e) {
        printErrorToBuildConsole(listener, e);
    }

}
 
开发者ID:groupon,项目名称:DotCi,代码行数:32,代码来源:CommitStatusUpdateRunListener.java

示例9: perform

@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,
                    @Nonnull TaskListener listener) throws InterruptedException, IOException {
    PrintStream listenerLogger = listener.getLogger();
    String publishedURL = getTriggerDescriptor().getJenkinsURL();

    if (getStatusVerifier() != null && !getStatusVerifier().isRunAllowed(run)) {
        return;
    }

    if (isEmpty(publishedURL)) {
        return;
    }

    GHCommitState state = getCommitState(run, unstableAs);

    GitHubPRCause c = ghPRCauseFromRun(run);

    String statusMsgValue = getStatusMsg().expandAll(run, listener);
    String buildUrl = publishedURL + run.getUrl();

    LOGGER.info("Setting status of {} to {} with url {} and message: {}",
            c.getHeadSha(), state, buildUrl, statusMsgValue);

    // TODO check permissions to write human friendly message
    final GitHubPRTrigger trigger = ghPRTriggerFromRun(run);
    if (isNull(trigger)) {
        listener.error("Can't get trigger for this run! Silently skipping. " +
                "TODO implement error handler, like in publishers");
        return;
    }

    try {
        trigger.getRemoteRepository().createCommitStatus(c.getHeadSha(), state, buildUrl, statusMsgValue,
                run.getParent().getFullName());
    } catch (IOException ex) {
        if (nonNull(buildMessage)) {
            String comment = null;
            LOGGER.error("Could not update commit status of the Pull Request on GitHub. ", ex);
            if (state == GHCommitState.SUCCESS) {
                comment = buildMessage.getSuccessMsg().expandAll(run, listener);
            } else if (state == GHCommitState.FAILURE) {
                comment = buildMessage.getFailureMsg().expandAll(run, listener);
            }
            listenerLogger.println("Adding comment...");
            LOGGER.info("Adding comment, because: ", ex);
            addComment(c.getNumber(), comment, run, listener);
        } else {
            listenerLogger.println("Could not update commit status of the Pull Request on GitHub." + ex.getMessage());
            LOGGER.error("Could not update commit status of the Pull Request on GitHub.", ex);
        }
        handlePublisherError(run);
    }
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:54,代码来源:GitHubPRBuildStatusPublisher.java


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