use of org.eclipse.jkube.kit.build.service.docker.access.DockerAccess in project jkube by eclipse.
the class DockerAccessFactory method createDockerAccess.
public DockerAccess createDockerAccess(DockerAccessContext dockerAccessContext) {
try {
DockerConnectionDetector dockerConnectionDetector = createDockerConnectionDetector(dockerAccessContext, dockerAccessContext.getLog());
DockerConnectionDetector.ConnectionParameter connectionParam = dockerConnectionDetector.detectConnectionParameter(dockerAccessContext.getDockerHost(), dockerAccessContext.getCertPath());
DockerAccess access = new DockerAccessWithHcClient(connectionParam.getUrl(), connectionParam.getCertPath(), dockerAccessContext.getMaxConnections(), dockerAccessContext.getLog());
access.start();
setDockerHostAddressProperty(dockerAccessContext, connectionParam.getUrl());
return access;
} catch (IOException e) {
throw new IllegalStateException("Cannot create docker access object ", e);
}
}
use of org.eclipse.jkube.kit.build.service.docker.access.DockerAccess in project jkube by eclipse.
the class AbstractDockerMojo method doExecute.
protected void doExecute() throws MojoExecutionException {
final boolean ansiRestore = Ansi.isEnabled();
try {
DockerAccess dockerAccess = null;
try {
javaProject = MavenUtil.convertMavenProjectToJKubeProject(project, session);
resources = updateResourceConfigNamespace(namespace, resources);
// The 'real' images configuration to use (configured images + externally resolved images)
if (isDockerAccessRequired()) {
DockerAccessFactory.DockerAccessContext dockerAccessContext = getDockerAccessContext();
dockerAccess = dockerAccessFactory.createDockerAccess(dockerAccessContext);
}
jkubeServiceHub = JKubeServiceHub.builder().log(log).configuration(initJKubeConfiguration()).clusterAccess(clusterAccess).platformMode(getConfiguredRuntimeMode()).dockerServiceHub(DockerServiceHub.newInstance(log, dockerAccess, logOutputSpecFactory)).buildServiceConfig(buildServiceConfigBuilder().build()).offline(offline).build();
resolvedImages = ConfigHelper.initImageConfiguration(apiVersion, getBuildTimestamp(getPluginContext(), CONTEXT_KEY_BUILD_TIMESTAMP, project.getBuild().getDirectory(), DOCKER_BUILD_TIMESTAMP), images, imageConfigResolver, log, filter, this, jkubeServiceHub.getConfiguration());
executeInternal();
} catch (IOException | DependencyResolutionRequiredException exp) {
logException(exp);
throw new MojoExecutionException(exp.getMessage());
} catch (MojoExecutionException exp) {
logException(exp);
throw exp;
} finally {
Optional.ofNullable(jkubeServiceHub).ifPresent(JKubeServiceHub::close);
}
} finally {
Ansi.setEnabled(ansiRestore);
}
}
Aggregations