Search in sources :

Example 1 with ExitCodeChecker

use of org.eclipse.jkube.kit.build.service.docker.wait.ExitCodeChecker in project jkube by eclipse.

the class WaitService method prepareWaitCheckers.

private List<WaitChecker> prepareWaitCheckers(ImageConfiguration imageConfig, Properties projectProperties, String containerId) throws IOException {
    WaitConfiguration wait = getWaitConfiguration(imageConfig);
    if (wait == null) {
        return Collections.emptyList();
    }
    List<WaitChecker> checkers = new ArrayList<>();
    if (wait.getUrl() != null) {
        checkers.add(getUrlWaitChecker(imageConfig.getDescription(), projectProperties, wait));
    }
    if (wait.getLog() != null) {
        log.debug("LogWaitChecker: Waiting on %s", wait.getLog());
        checkers.add(new LogWaitChecker(wait.getLog(), dockerAccess, containerId, log));
    }
    if (wait.getTcp() != null) {
        try {
            Container container = queryService.getMandatoryContainer(containerId);
            checkers.add(getTcpWaitChecker(container, imageConfig.getDescription(), projectProperties, wait.getTcp()));
        } catch (DockerAccessException e) {
            throw new IOException("Unable to access container " + containerId, e);
        }
    }
    if (wait.getHealthy() == Boolean.TRUE) {
        checkers.add(new HealthCheckChecker(dockerAccess, containerId, imageConfig.getDescription(), log));
    }
    if (wait.getExit() != null) {
        checkers.add(new ExitCodeChecker(wait.getExit(), queryService, containerId));
    }
    return checkers;
}
Also used : WaitConfiguration(org.eclipse.jkube.kit.config.image.WaitConfiguration) HealthCheckChecker(org.eclipse.jkube.kit.build.service.docker.wait.HealthCheckChecker) Container(org.eclipse.jkube.kit.build.api.model.Container) LogWaitChecker(org.eclipse.jkube.kit.build.service.docker.wait.LogWaitChecker) DockerAccessException(org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException) ArrayList(java.util.ArrayList) ExitCodeChecker(org.eclipse.jkube.kit.build.service.docker.wait.ExitCodeChecker) IOException(java.io.IOException) WaitChecker(org.eclipse.jkube.kit.build.service.docker.wait.WaitChecker) LogWaitChecker(org.eclipse.jkube.kit.build.service.docker.wait.LogWaitChecker)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Container (org.eclipse.jkube.kit.build.api.model.Container)1 DockerAccessException (org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException)1 ExitCodeChecker (org.eclipse.jkube.kit.build.service.docker.wait.ExitCodeChecker)1 HealthCheckChecker (org.eclipse.jkube.kit.build.service.docker.wait.HealthCheckChecker)1 LogWaitChecker (org.eclipse.jkube.kit.build.service.docker.wait.LogWaitChecker)1 WaitChecker (org.eclipse.jkube.kit.build.service.docker.wait.WaitChecker)1 WaitConfiguration (org.eclipse.jkube.kit.config.image.WaitConfiguration)1