Search in sources :

Example 56 with BuildConfiguration

use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.

the class ReplicationControllerHandlerTest method before.

@Before
public void before() {
    // volume config with name and multiple mount
    mounts.add("/path/system");
    mounts.add("/path/sys");
    ports.add("8080");
    ports.add("9090");
    tags.add("latest");
    tags.add("test");
    VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
    volumes1.add(volumeConfig1);
    // container name with alias
    final BuildConfiguration buildImageConfiguration = BuildConfiguration.builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compressionString("gzip").build();
    ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("test").alias("test-app").build(buildImageConfiguration).registry("docker.io").build();
    images.add(imageConfiguration);
    replicationControllerHandler = new ReplicationControllerHandler(new PodTemplateHandler(new ContainerHandler(project.getProperties(), new GroupArtifactVersion("g", "a", "v"), probeHandler)));
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) VolumeConfig(org.eclipse.jkube.kit.config.resource.VolumeConfig) Before(org.junit.Before)

Example 57 with BuildConfiguration

use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.

the class StatefulSetHandlerTest method before.

@Before
public void before() {
    // volume config with name and multiple mount
    mounts.add("/path/system");
    mounts.add("/path/sys");
    ports.add("8080");
    ports.add("9090");
    tags.add("latest");
    tags.add("test");
    VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
    volumes1.add(volumeConfig1);
    // container name with alias
    final BuildConfiguration buildImageConfiguration = BuildConfiguration.builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compressionString("gzip").build();
    ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("test").alias("test-app").build(buildImageConfiguration).registry("docker.io").build();
    images.add(imageConfiguration);
    statefulSetHandler = new StatefulSetHandler(new PodTemplateHandler(new ContainerHandler(project.getProperties(), new GroupArtifactVersion("g", "a", "v"), probeHandler)));
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) VolumeConfig(org.eclipse.jkube.kit.config.resource.VolumeConfig) Before(org.junit.Before)

Example 58 with BuildConfiguration

use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.

the class JibServiceUtil method jibPush.

/**
 * Push Image to registry using JIB
 *
 * @param imageConfiguration ImageConfiguration
 * @param pushCredentials    push credentials
 * @param tarArchive         tar archive built during build goal
 * @param log                Logger
 */
public static void jibPush(ImageConfiguration imageConfiguration, Credential pushCredentials, File tarArchive, KitLogger log) {
    BuildConfiguration buildImageConfiguration = imageConfiguration.getBuildConfiguration();
    String imageName = getFullImageName(imageConfiguration, null);
    try {
        for (String tag : getAllImageTags(buildImageConfiguration.getTags(), imageName)) {
            String imageNameWithTag = getFullImageName(imageConfiguration, tag);
            log.info("Pushing image: %s", imageNameWithTag);
            pushImage(TarImage.at(tarArchive.toPath()), imageNameWithTag, pushCredentials, log);
        }
    } catch (IllegalStateException e) {
        log.error("Exception occurred while pushing the image: %s", imageConfiguration.getName());
        throw new IllegalStateException(e.getMessage(), e);
    } catch (InterruptedException e) {
        log.error("Thread interrupted", e);
        Thread.currentThread().interrupt();
    }
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration)

Aggregations

BuildConfiguration (org.eclipse.jkube.kit.config.image.build.BuildConfiguration)58 Test (org.junit.Test)39 ImageConfiguration (org.eclipse.jkube.kit.config.image.ImageConfiguration)24 File (java.io.File)23 Properties (java.util.Properties)11 AssemblyFile (org.eclipse.jkube.kit.common.AssemblyFile)10 JKubeConfiguration (org.eclipse.jkube.kit.common.JKubeConfiguration)10 RunImageConfiguration (org.eclipse.jkube.kit.config.image.RunImageConfiguration)8 GroupArtifactVersion (org.eclipse.jkube.kit.config.resource.GroupArtifactVersion)8 Before (org.junit.Before)8 AssemblyConfiguration (org.eclipse.jkube.kit.common.AssemblyConfiguration)7 ArrayList (java.util.ArrayList)6 Expectations (mockit.Expectations)5 VolumeConfig (org.eclipse.jkube.kit.config.resource.VolumeConfig)5 Verifications (mockit.Verifications)4 List (java.util.List)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Assembly (org.eclipse.jkube.kit.common.Assembly)3 AssemblyFileEntry (org.eclipse.jkube.kit.common.AssemblyFileEntry)3 JavaProject (org.eclipse.jkube.kit.common.JavaProject)3