Java Code Examples for io.fabric8.openshift.api.model.Build#getStatus()

The following examples show how to use io.fabric8.openshift.api.model.Build#getStatus() . 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: KubernetesResourceUtil.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
public static String getBuildStatusReason(Build build) {
    if (build != null && build.getStatus() != null) {
        String reason = build.getStatus().getReason();
        String phase = build.getStatus().getPhase();
        if (StringUtils.isNotBlank(phase)) {
            if (StringUtils.isNotBlank(reason)) {
                return phase + ": " + reason;
            } else {
                return phase;
            }
        } else {
            return StringUtils.defaultIfEmpty(reason, "");
        }
    }
    return "";
}
 
Example 2
Source File: KubernetesHelper.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
public static String getBuildStatusReason(Build build) {
    if (build != null && build.getStatus() != null) {
        String reason = build.getStatus().getReason();
        String phase = build.getStatus().getPhase();
        if (StringUtils.isNotBlank(phase)) {
            if (StringUtils.isNotBlank(reason)) {
                return phase + ": " + reason;
            } else {
                return phase;
            }
        } else {
            return StringUtils.defaultIfEmpty(reason, "");
        }
    }
    return "";
}
 
Example 3
Source File: OpenShiftServiceImpl.java    From syndesis with Apache License 2.0 6 votes vote down vote up
private Build waitForBuild(Build r, long timeout, TimeUnit timeUnit) throws InterruptedException {
    long end = System.currentTimeMillis() + timeUnit.toMillis(timeout);
    Build next = r;

    int retriesLeft = config.getMaximumRetries();
    while ( System.currentTimeMillis() < end) {
        if (next.getStatus() != null && ("Complete".equals(next.getStatus().getPhase()) || "Failed".equals(next.getStatus().getPhase()))) {
            return next;
        }
        try {
            next = openShiftClient.builds().inNamespace(next.getMetadata().getNamespace()).withName(next.getMetadata().getName()).get();
        } catch (KubernetesClientException e) {
            checkRetryPolicy(e, retriesLeft--);
        }
        Thread.sleep(config.getPollingInterval());
    }
    throw SyndesisServerException.launderThrowable(new TimeoutException("Timed out waiting for build completion."));
}
 
Example 4
Source File: KubernetesResourceUtil.java    From jkube with Eclipse Public License 2.0 4 votes vote down vote up
public static String getBuildStatusPhase(Build build) {
    if (build != null && build.getStatus() != null) {
        return build.getStatus().getPhase();
    }
    return null;
}
 
Example 5
Source File: KubernetesHelper.java    From jkube with Eclipse Public License 2.0 4 votes vote down vote up
public static String getBuildStatusPhase(Build build) {
    if (build != null && build.getStatus() != null) {
        return build.getStatus().getPhase();
    }
    return null;
}