Search in sources :

Example 6 with BuildRequest

use of org.springframework.boot.buildpack.platform.build.BuildRequest in project spring-boot by spring-projects.

the class ImageTests method getBuildRequestWhenHasRunImageUsesRunImage.

@Test
void getBuildRequestWhenHasRunImageUsesRunImage() {
    Image image = new Image();
    image.runImage = "springboot/run:latest";
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.getRunImage().toString()).isEqualTo("docker.io/springboot/run:latest");
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Example 7 with BuildRequest

use of org.springframework.boot.buildpack.platform.build.BuildRequest in project spring-boot by spring-projects.

the class ImageTests method getBuildRequestWhenNoCustomizationsUsesDefaults.

@Test
void getBuildRequestWhenNoCustomizationsUsesDefaults() {
    BuildRequest request = new Image().getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.getName().toString()).isEqualTo("docker.io/library/my-app:0.0.1-SNAPSHOT");
    assertThat(request.getBuilder().toString()).contains("paketobuildpacks/builder");
    assertThat(request.getRunImage()).isNull();
    assertThat(request.getEnv()).isEmpty();
    assertThat(request.isCleanCache()).isFalse();
    assertThat(request.isVerboseLogging()).isFalse();
    assertThat(request.getPullPolicy()).isEqualTo(PullPolicy.ALWAYS);
    assertThat(request.getBuildpacks()).isEmpty();
    assertThat(request.getBindings()).isEmpty();
    assertThat(request.getNetwork()).isNull();
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Example 8 with BuildRequest

use of org.springframework.boot.buildpack.platform.build.BuildRequest in project spring-boot by spring-projects.

the class ImageTests method getBuildRequestWhenHasBuildpacksUsesBuildpacks.

@Test
void getBuildRequestWhenHasBuildpacksUsesBuildpacks() {
    Image image = new Image();
    image.buildpacks = Arrays.asList("example/buildpack1@0.0.1", "example/buildpack2@0.0.2");
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.getBuildpacks()).containsExactly(BuildpackReference.of("example/buildpack1@0.0.1"), BuildpackReference.of("example/buildpack2@0.0.2"));
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Example 9 with BuildRequest

use of org.springframework.boot.buildpack.platform.build.BuildRequest in project spring-boot by spring-projects.

the class ImageTests method getBuildRequestWhenNameIsSetUsesName.

@Test
void getBuildRequestWhenNameIsSetUsesName() {
    Image image = new Image();
    image.name = "demo";
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.getName().toString()).isEqualTo("docker.io/library/demo:latest");
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Example 10 with BuildRequest

use of org.springframework.boot.buildpack.platform.build.BuildRequest in project spring-boot by spring-projects.

the class ImageTests method getBuildRequestWhenHasPullPolicyUsesPullPolicy.

@Test
void getBuildRequestWhenHasPullPolicyUsesPullPolicy() {
    Image image = new Image();
    image.setPullPolicy(PullPolicy.NEVER);
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.getPullPolicy()).isEqualTo(PullPolicy.NEVER);
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Aggregations

BuildRequest (org.springframework.boot.buildpack.platform.build.BuildRequest)23 Test (org.junit.jupiter.api.Test)20 Builder (org.springframework.boot.buildpack.platform.build.Builder)3 IOException (java.io.IOException)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 DockerConfiguration (org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration)2 Libraries (org.springframework.boot.loader.tools.Libraries)2 VolumeCacheInfo (org.springframework.boot.maven.CacheInfo.VolumeCacheInfo)2 File (java.io.File)1 OutputStream (java.io.OutputStream)1 Duration (java.time.Duration)1 Collections (java.util.Collections)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 ZipEntry (java.util.zip.ZipEntry)1 TarArchiveEntry (org.apache.commons.compress.archivers.tar.TarArchiveEntry)1 TarArchiveOutputStream (org.apache.commons.compress.archivers.tar.TarArchiveOutputStream)1 TarConstants (org.apache.commons.compress.archivers.tar.TarConstants)1 Artifact (org.apache.maven.artifact.Artifact)1