Java Code Examples for org.kohsuke.github.GHCommitState#ERROR

The following examples show how to use org.kohsuke.github.GHCommitState#ERROR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitHubNotificationContext.java    From github-branch-source-plugin with MIT License 6 votes vote down vote up
/**
 * Retrieves default notification state
 * @param listener Listener for the build, if any
 * @return Default notification state
 * @since 2.3.2
 */
public GHCommitState getDefaultState(TaskListener listener) {
    if (null != build && !build.isBuilding()) {
        Result result = build.getResult();
        if (Result.SUCCESS.equals(result)) {
            return GHCommitState.SUCCESS;
        } else if (Result.UNSTABLE.equals(result)) {
            return GHCommitState.FAILURE;
        } else if (Result.FAILURE.equals(result)) {
            return GHCommitState.ERROR;
        } else if (Result.ABORTED.equals(result)) {
            return GHCommitState.ERROR;
        } else if (result != null) { // NOT_BUILT etc.
            return GHCommitState.ERROR;
        }
    }
    return GHCommitState.PENDING;
}
 
Example 2
Source File: GitHubStatusPostStage.java    From bamboo-github-status with MIT License 5 votes vote down vote up
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;
    }
}
 
Example 3
Source File: GitHubProvider.java    From gocd-build-status-notifier with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: JobHelper.java    From github-integration-plugin with MIT License 5 votes vote down vote up
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;
}
 
Example 5
Source File: GitHubPRStatusPublisherDslContext.java    From github-integration-plugin with MIT License 4 votes vote down vote up
public void unstableAsError() {
    this.state = GHCommitState.ERROR;
}