use of io.fabric8.maven.docker.config.ImageConfiguration in project fabric8-maven-plugin by fabric8io.
the class SpringBootWatcher method watch.
@Override
public void watch(List<ImageConfiguration> configs, Set<HasMetadata> resources, PlatformMode mode) throws Exception {
KubernetesClient kubernetes = getContext().getKubernetesClient();
PodLogService.PodLogServiceContext logContext = new PodLogService.PodLogServiceContext.Builder().log(log).newPodLog(getContext().getNewPodLogger()).oldPodLog(getContext().getOldPodLogger()).build();
new PodLogService(logContext).tailAppPodsLogs(kubernetes, getContext().getNamespace(), resources, false, null, true, null, false);
String url = getServiceExposeUrl(kubernetes, resources);
if (url == null) {
url = getPortForwardUrl(resources);
}
if (url != null) {
runRemoteSpringApplication(url);
} else {
throw new IllegalStateException("Unable to open a channel to the remote pod.");
}
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testDockerFile.
@Test
public void testDockerFile() {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.DOCKER_FILE), "file" };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertNotNull(config.getBuildConfiguration());
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testDockerArchive.
@Test
public void testDockerArchive() {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.DOCKER_ARCHIVE), "dockerLoad.tar", k(ConfigKey.FROM), "busybox" };
ImageConfiguration config = resolveExternalImageConfig(testData);
config.initAndValidate(ConfigHelper.NameFormatter.IDENTITY, null);
assertFalse(config.getBuildConfiguration().isDockerFileMode());
assertEquals(new File("dockerLoad.tar"), config.getBuildConfiguration().getDockerArchive());
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testNamingScheme.
@Test
public void testNamingScheme() throws Exception {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.NAMING_STRATEGY), RunImageConfiguration.NamingStrategy.alias.toString() };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(RunImageConfiguration.NamingStrategy.alias, config.getRunConfiguration().getNamingStrategy());
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testMergedEnv.
@Test
public void testMergedEnv() throws Exception {
List<ImageConfiguration> configs = resolveImage(imageConfiguration, props("docker.from", "baase", "docker.name", "demo", "docker.env.HOME", "/tmp", "docker.envBuild.HOME", "/var/tmp", "docker.envRun.root.dir", "/bla"));
assertEquals(1, configs.size());
ImageConfiguration calcConfig = configs.get(0);
Map<String, String> env;
env = calcConfig.getBuildConfiguration().getEnv();
assertEquals(1, env.size());
assertEquals("/var/tmp", env.get("HOME"));
env = calcConfig.getRunConfiguration().getEnv();
assertEquals(2, env.size());
assertEquals("/tmp", env.get("HOME"));
assertEquals("/bla", env.get("root.dir"));
}
Aggregations