Search in sources :

Example 46 with ImageConfiguration

use of com.google.cloud.tools.jib.configuration.ImageConfiguration in project jib by GoogleContainerTools.

the class ContainerizerTest method testGetImageConfiguration_dockerDaemonImage.

@Test
public void testGetImageConfiguration_dockerDaemonImage() throws InvalidImageReferenceException {
    Containerizer containerizer = Containerizer.to(DockerDaemonImage.named("docker/deamon/image"));
    ImageConfiguration imageConfiguration = containerizer.getImageConfiguration();
    Assert.assertEquals("docker/deamon/image", imageConfiguration.getImage().toString());
    Assert.assertEquals(0, imageConfiguration.getCredentialRetrievers().size());
}
Also used : ImageConfiguration(com.google.cloud.tools.jib.configuration.ImageConfiguration) Test(org.junit.Test)

Example 47 with ImageConfiguration

use of com.google.cloud.tools.jib.configuration.ImageConfiguration in project jib by GoogleContainerTools.

the class PluginConfigurationProcessorTest method testGetJavaContainerBuilderWithBaseImage_tarBase.

@Test
public void testGetJavaContainerBuilderWithBaseImage_tarBase() throws IncompatibleBaseImageJavaVersionException, IOException, InvalidImageReferenceException, CacheDirectoryCreationException {
    when(rawConfiguration.getFromImage()).thenReturn(Optional.of("tar:///path/to.tar"));
    ImageConfiguration result = getCommonImageConfiguration();
    assertThat(result.getTarPath()).hasValue(Paths.get("/path/to.tar"));
    assertThat(result.getDockerClient()).isEmpty();
}
Also used : ImageConfiguration(com.google.cloud.tools.jib.configuration.ImageConfiguration) Test(org.junit.Test)

Example 48 with ImageConfiguration

use of com.google.cloud.tools.jib.configuration.ImageConfiguration in project jib by GoogleContainerTools.

the class PluginConfigurationProcessorTest method testGetJavaContainerBuilderWithBaseImage_java12BaseImage.

// https://github.com/GoogleContainerTools/jib/issues/1995
@Test
public void testGetJavaContainerBuilderWithBaseImage_java12BaseImage() throws InvalidImageReferenceException, IOException, IncompatibleBaseImageJavaVersionException, CacheDirectoryCreationException {
    when(projectProperties.getMajorJavaVersion()).thenReturn(12);
    when(rawConfiguration.getFromImage()).thenReturn(Optional.of("regis.try/java12image"));
    ImageConfiguration imageConfiguration = getCommonImageConfiguration();
    assertThat(imageConfiguration.getImageRegistry()).isEqualTo("regis.try");
    assertThat(imageConfiguration.getImageRepository()).isEqualTo("java12image");
}
Also used : ImageConfiguration(com.google.cloud.tools.jib.configuration.ImageConfiguration) Test(org.junit.Test)

Example 49 with ImageConfiguration

use of com.google.cloud.tools.jib.configuration.ImageConfiguration in project jib by GoogleContainerTools.

the class PluginConfigurationProcessorTest method testGetJavaContainerBuilderWithBaseImage_dockerBase.

@Test
public void testGetJavaContainerBuilderWithBaseImage_dockerBase() throws IncompatibleBaseImageJavaVersionException, IOException, InvalidImageReferenceException, CacheDirectoryCreationException {
    when(rawConfiguration.getFromImage()).thenReturn(Optional.of("docker://ima.ge/name"));
    ImageConfiguration result = getCommonImageConfiguration();
    assertThat(result.getImage().toString()).isEqualTo("ima.ge/name");
    assertThat(result.getDockerClient()).isPresent();
    assertThat(result.getTarPath()).isEmpty();
}
Also used : ImageConfiguration(com.google.cloud.tools.jib.configuration.ImageConfiguration) Test(org.junit.Test)

Aggregations

ImageConfiguration (com.google.cloud.tools.jib.configuration.ImageConfiguration)49 Test (org.junit.Test)41 BuildContext (com.google.cloud.tools.jib.configuration.BuildContext)21 Platform (com.google.cloud.tools.jib.api.buildplan.Platform)12 EventHandlers (com.google.cloud.tools.jib.event.EventHandlers)8 Path (java.nio.file.Path)8 ExecutorService (java.util.concurrent.ExecutorService)8 BuildResult (com.google.cloud.tools.jib.builder.steps.BuildResult)7 ContainerizerTestProxy (com.google.cloud.tools.jib.api.ContainerizerTestProxy)6 JibContainerBuilder (com.google.cloud.tools.jib.api.JibContainerBuilder)6 ContainerBuildPlan (com.google.cloud.tools.jib.api.buildplan.ContainerBuildPlan)6 StepsRunner (com.google.cloud.tools.jib.builder.steps.StepsRunner)6 ContainerConfiguration (com.google.cloud.tools.jib.configuration.ContainerConfiguration)6 DockerClient (com.google.cloud.tools.jib.docker.DockerClient)6 XdgDirectories (com.google.cloud.tools.jib.filesystem.XdgDirectories)6 Preconditions (com.google.common.base.Preconditions)6 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)6 ImmutableListMultimap (com.google.common.collect.ImmutableListMultimap)6 ImmutableSet (com.google.common.collect.ImmutableSet)6 ListMultimap (com.google.common.collect.ListMultimap)6