Search in sources :

Example 11 with BuildRequest

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

the class ImageTests method getBuildRequestWhenHasBuildVolumeCacheUsesCache.

@Test
void getBuildRequestWhenHasBuildVolumeCacheUsesCache() {
    Image image = new Image();
    image.buildCache = new CacheInfo(new VolumeCacheInfo("build-cache-vol"));
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.getBuildCache()).isEqualTo(Cache.volume("build-cache-vol"));
}
Also used : VolumeCacheInfo(org.springframework.boot.maven.CacheInfo.VolumeCacheInfo) BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) VolumeCacheInfo(org.springframework.boot.maven.CacheInfo.VolumeCacheInfo) Test(org.junit.jupiter.api.Test)

Example 12 with BuildRequest

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

the class ImageTests method getBuildRequestWhenHasCleanCacheUsesCleanCache.

@Test
void getBuildRequestWhenHasCleanCacheUsesCleanCache() {
    Image image = new Image();
    image.cleanCache = true;
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.isCleanCache()).isTrue();
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Example 13 with BuildRequest

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

the class ImageTests method getBuildRequestWhenHasPublishUsesPublish.

@Test
void getBuildRequestWhenHasPublishUsesPublish() {
    Image image = new Image();
    image.publish = true;
    BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
    assertThat(request.isPublish()).isTrue();
}
Also used : BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) Test(org.junit.jupiter.api.Test)

Example 14 with BuildRequest

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

the class BootBuildImage method buildImage.

@TaskAction
void buildImage() throws DockerEngineException, IOException {
    Builder builder = new Builder(this.docker.asDockerConfiguration());
    BuildRequest request = createRequest();
    builder.build(request);
}
Also used : Builder(org.springframework.boot.buildpack.platform.build.Builder) BuildRequest(org.springframework.boot.buildpack.platform.build.BuildRequest) TaskAction(org.gradle.api.tasks.TaskAction)

Example 15 with BuildRequest

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

the class BootBuildImageTests method whenImageNameIsSpecifiedThenItIsUsedInRequest.

@Test
void whenImageNameIsSpecifiedThenItIsUsedInRequest() {
    this.project.setVersion("1.2.3");
    this.buildImage.setImageName("example.com/test/build-image:1.0");
    assertThat(this.buildImage.getImageName()).isEqualTo("example.com/test/build-image:1.0");
    BuildRequest request = this.buildImage.createRequest();
    assertThat(request.getName().getDomain()).isEqualTo("example.com");
    assertThat(request.getName().getName()).isEqualTo("test/build-image");
    assertThat(request.getName().getTag()).isEqualTo("1.0");
    assertThat(request.getName().getDigest()).isNull();
}
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