Use paketo-buildpacks/builder as default builder
This commit changes the default builder image from `cloudfoundry/cnb:bionic-platform-api-0.2` to `gcr.io/paketo-buildpacks/builder:base-platform-api-0.3`. It also uses a `paketo-buildpacks/builder` image instead of a `cloudfoundry/cnb` image to test compatibility with lifecycle v2 and uses paketo naming instead of cloudfoundry when mocking builder interactions. Some adjustments to lifecycle phases were also made to align more closely with the pack CLI. Fixes gh-21066
This commit is contained in:
parent
14c88b3c04
commit
f3d717e97a
|
|
@ -29,6 +29,7 @@ import org.springframework.boot.buildpack.platform.docker.type.VolumeName;
|
|||
* Base class for {@link BuildLog} implementations.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public abstract class AbstractBuildLog implements BuildLog {
|
||||
|
|
@ -73,6 +74,13 @@ public abstract class AbstractBuildLog implements BuildLog {
|
|||
return (event) -> log(prefix + event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void skippingPhase(String name, String reason) {
|
||||
log();
|
||||
log(" > Skipping " + name + " " + reason);
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executedLifecycle(BuildRequest request) {
|
||||
log();
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.springframework.boot.buildpack.platform.docker.type.VolumeName;
|
|||
* Callback interface used to provide {@link Builder} output logging.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
* @since 2.3.0
|
||||
* @see #toSystemOut()
|
||||
*/
|
||||
|
|
@ -86,6 +87,13 @@ public interface BuildLog {
|
|||
*/
|
||||
Consumer<LogUpdateEvent> runningPhase(BuildRequest request, String name);
|
||||
|
||||
/**
|
||||
* Log that a specific phase is being skipped.
|
||||
* @param name the name of the phase
|
||||
* @param reason the reason the phase is skipped
|
||||
*/
|
||||
void skippingPhase(String name, String reason);
|
||||
|
||||
/**
|
||||
* Log that the lifecycle has executed.
|
||||
* @param request the build request
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
public class BuildRequest {
|
||||
|
||||
static final String DEFAULT_BUILDER_IMAGE_NAME = "cloudfoundry/cnb:bionic-platform-api-0.2";
|
||||
static final String DEFAULT_BUILDER_IMAGE_NAME = "gcr.io/paketo-buildpacks/builder:base-platform-api-0.3";
|
||||
|
||||
private static final ImageReference DEFAULT_BUILDER = ImageReference.of(DEFAULT_BUILDER_IMAGE_NAME);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import org.springframework.util.Assert;
|
|||
* application.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
class Lifecycle implements Closeable {
|
||||
|
||||
|
|
@ -116,7 +117,12 @@ class Lifecycle implements Closeable {
|
|||
}
|
||||
run(detectPhase());
|
||||
run(analyzePhase());
|
||||
run(restorePhase());
|
||||
if (this.request.isCleanCache()) {
|
||||
this.log.skippingPhase("restorer", "due to cleaning cache");
|
||||
}
|
||||
else {
|
||||
run(restorePhase());
|
||||
}
|
||||
run(buildPhase());
|
||||
run(exportPhase());
|
||||
this.log.executedLifecycle(this.request);
|
||||
|
|
@ -144,12 +150,14 @@ class Lifecycle implements Closeable {
|
|||
Phase phase = createPhase("analyzer");
|
||||
phase.withDaemonAccess();
|
||||
phase.withLogLevelArg();
|
||||
phase.withArgs("-daemon");
|
||||
if (this.request.isCleanCache()) {
|
||||
phase.withArgs("-skip-layers");
|
||||
}
|
||||
phase.withArgs("-daemon");
|
||||
else {
|
||||
phase.withArgs("-cache-dir", Directory.CACHE);
|
||||
}
|
||||
phase.withArgs("-layers", Directory.LAYERS);
|
||||
phase.withArgs("-cache-dir", Directory.CACHE);
|
||||
phase.withArgs(this.request.getName());
|
||||
phase.withBinds(this.buildCacheVolume, Directory.CACHE);
|
||||
return phase;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class BuildRequestTests {
|
|||
writeTestJarFile(jarFile);
|
||||
BuildRequest request = BuildRequest.forJarFile(jarFile);
|
||||
assertThat(request.getName().toString()).isEqualTo("docker.io/library/my-app:0.0.1");
|
||||
assertThat(request.getBuilder().toString()).isEqualTo("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME);
|
||||
assertThat(request.getBuilder().toString()).isEqualTo(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME);
|
||||
assertThat(request.getApplicationContent(Owner.ROOT)).satisfies(this::hasExpectedJarContent);
|
||||
assertThat(request.getEnv()).isEmpty();
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ public class BuildRequestTests {
|
|||
writeTestJarFile(jarFile);
|
||||
BuildRequest request = BuildRequest.forJarFile(ImageReference.of("test-app"), jarFile);
|
||||
assertThat(request.getName().toString()).isEqualTo("docker.io/library/test-app:latest");
|
||||
assertThat(request.getBuilder().toString()).isEqualTo("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME);
|
||||
assertThat(request.getBuilder().toString()).isEqualTo(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME);
|
||||
assertThat(request.getApplicationContent(Owner.ROOT)).satisfies(this::hasExpectedJarContent);
|
||||
assertThat(request.getEnv()).isEmpty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class BuilderTests {
|
|||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
|
|
@ -96,7 +96,7 @@ class BuilderTests {
|
|||
DockerApi docker = mockDockerApi();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image-with-bad-stack.json");
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
|
|
@ -112,7 +112,7 @@ class BuilderTests {
|
|||
DockerApi docker = mockDockerApiLifecycleError();
|
||||
Image builderImage = loadImage("image.json");
|
||||
Image runImage = loadImage("run-image.json");
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/" + BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any()))
|
||||
given(docker.image().pull(eq(ImageReference.of(BuildRequest.DEFAULT_BUILDER_IMAGE_NAME)), any()))
|
||||
.willAnswer(withPulledImage(builderImage));
|
||||
given(docker.image().pull(eq(ImageReference.of("docker.io/cloudfoundry/run:base-cnb")), any()))
|
||||
.willAnswer(withPulledImage(runImage));
|
||||
|
|
|
|||
|
|
@ -128,6 +128,11 @@ class LifecycleTests {
|
|||
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
|
||||
BuildRequest request = getTestRequest().withCleanCache(true);
|
||||
createLifecycle(request).execute();
|
||||
assertPhaseWasRun("detector", withExpectedConfig("lifecycle-detector.json"));
|
||||
assertPhaseWasRun("analyzer", withExpectedConfig("lifecycle-analyzer-clean-cache.json"));
|
||||
assertPhaseWasNotRun("restorer");
|
||||
assertPhaseWasRun("builder", withExpectedConfig("lifecycle-builder.json"));
|
||||
assertPhaseWasRun("exporter", withExpectedConfig("lifecycle-exporter.json"));
|
||||
VolumeName name = VolumeName.of("pack-cache-b35197ac41ea.build");
|
||||
verify(this.docker.volume()).delete(name, true);
|
||||
}
|
||||
|
|
@ -201,6 +206,11 @@ class LifecycleTests {
|
|||
configConsumer.accept(this.configs.get(containerReference.toString()));
|
||||
}
|
||||
|
||||
private void assertPhaseWasNotRun(String name) {
|
||||
ContainerReference containerReference = ContainerReference.of("lifecycle-" + name);
|
||||
assertThat(this.configs.get(containerReference.toString())).isNull();
|
||||
}
|
||||
|
||||
private IOConsumer<ContainerConfig> withExpectedConfig(String name) {
|
||||
return (config) -> {
|
||||
InputStream in = getClass().getResourceAsStream(name);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class DockerApiIntegrationTests {
|
|||
|
||||
@Test
|
||||
void pullImage() throws IOException {
|
||||
this.docker.image().pull(ImageReference.of("cloudfoundry/cnb:bionic"),
|
||||
this.docker.image().pull(ImageReference.of("gcr.io/paketo-buildpacks/builder:base"),
|
||||
new TotalProgressPullListener(new TotalProgressBar("Pulling: ")));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@ class DockerApiTests {
|
|||
|
||||
@Test
|
||||
void pullPullsImageAndProducesEvents() throws Exception {
|
||||
ImageReference reference = ImageReference.of("cloudfoundry/cnb:bionic");
|
||||
URI createUri = new URI(IMAGES_URL + "/create?fromImage=docker.io%2Fcloudfoundry%2Fcnb%3Abionic");
|
||||
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
|
||||
URI createUri = new URI(IMAGES_URL + "/create?fromImage=gcr.io%2Fpaketo-buildpacks%2Fbuilder%3Abase");
|
||||
String imageHash = "4acb6bfd6c4f0cabaf7f3690e444afe51f1c7de54d51da7e63fac709c56f1c30";
|
||||
URI imageUri = new URI(IMAGES_URL + "/docker.io/cloudfoundry/cnb@sha256:" + imageHash + "/json");
|
||||
URI imageUri = new URI(IMAGES_URL + "/gcr.io/paketo-buildpacks/builder@sha256:" + imageHash + "/json");
|
||||
given(http().post(createUri)).willReturn(responseOf("pull-stream.json"));
|
||||
given(http().get(imageUri)).willReturn(responseOf("type/image.json"));
|
||||
Image image = this.api.pull(reference, this.pullListener);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class PullUpdateEventTests extends AbstractJsonTests {
|
|||
PullImageUpdateEvent event = getObjectMapper().readValue(getContent("pull-update-minimal.json"),
|
||||
PullImageUpdateEvent.class);
|
||||
assertThat(event.getId()).isNull();
|
||||
assertThat(event.getStatus()).isEqualTo("Status: Downloaded newer image for cloudfoundry/cnb:bionic");
|
||||
assertThat(event.getStatus()).isEqualTo("Status: Downloaded newer image for packeto-buildpacks/cnb:base");
|
||||
assertThat(event.getProgressDetail()).isNull();
|
||||
assertThat(event.getProgress()).isNull();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* Tests for {@link JsonStream}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
class JsonStreamTests extends AbstractJsonTests {
|
||||
|
||||
|
|
@ -43,7 +44,8 @@ class JsonStreamTests extends AbstractJsonTests {
|
|||
List<ObjectNode> result = new ArrayList<>();
|
||||
this.jsonStream.get(getContent("stream.json"), result::add);
|
||||
assertThat(result).hasSize(595);
|
||||
assertThat(result.get(594).toString()).contains("Status: Downloaded newer image for cloudfoundry/cnb:bionic");
|
||||
assertThat(result.get(594).toString())
|
||||
.contains("Status: Downloaded newer image for packeto-buildpacks/cnb:base");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -52,7 +54,8 @@ class JsonStreamTests extends AbstractJsonTests {
|
|||
this.jsonStream.get(getContent("stream.json"), TestEvent.class, result::add);
|
||||
assertThat(result).hasSize(595);
|
||||
assertThat(result.get(1).getId()).isEqualTo("5667fdb72017");
|
||||
assertThat(result.get(594).getStatus()).isEqualTo("Status: Downloaded newer image for cloudfoundry/cnb:bionic");
|
||||
assertThat(result.get(594).getStatus())
|
||||
.isEqualTo("Status: Downloaded newer image for packeto-buildpacks/cnb:base");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"Id": "sha256:44cc64492fb6a6d78d3e6d087f380ae6e479aa1b2c79823b32cdacfcc2f3d715",
|
||||
"RepoTags": [
|
||||
"cloudfoundry/cnb:bionic",
|
||||
"cloudfoundry/cnb:bionic-platform-api-0.3"
|
||||
"paketo-buildpacks/cnb:base",
|
||||
"paketo-buildpacks/builder:base-platform-api-0.2"
|
||||
],
|
||||
"RepoDigests": [
|
||||
"cloudfoundry/cnb@sha256:5b03a853e636b78c44e475bbc514e2b7b140cc41cca8ab907e9753431ae8c0b0"
|
||||
"packeto-buidpacks/cnb@sha256:5b03a853e636b78c44e475bbc514e2b7b140cc41cca8ab907e9753431ae8c0b0"
|
||||
],
|
||||
"Parent": "",
|
||||
"Comment": "",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"User" : "root",
|
||||
"Image" : "pack.local/ephemeral-builder",
|
||||
"Cmd" : [ "/lifecycle/cacher", "-path", "/cache", "-layers", "/layers" ],
|
||||
"Cmd" : [ "/lifecycle/analyzer", "-daemon", "-skip-layers", "-layers", "/layers", "docker.io/library/my-application:latest" ],
|
||||
"Labels" : {
|
||||
"author" : "spring-boot"
|
||||
},
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"User" : "root",
|
||||
"Image" : "pack.local/ephemeral-builder",
|
||||
"Cmd" : [ "/lifecycle/analyzer", "-daemon", "-layers", "/layers", "-cache-dir", "/cache", "docker.io/library/my-application:latest" ],
|
||||
"Cmd" : [ "/lifecycle/analyzer", "-daemon", "-cache-dir", "/cache", "-layers", "/layers", "docker.io/library/my-application:latest" ],
|
||||
"Labels" : {
|
||||
"author" : "spring-boot"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"Id": "sha256:9b450bffdb05bcf660d464d0bfdf344ee6ca38e9b8de4f408c8080b0c9319349",
|
||||
"RepoTags": [
|
||||
"cloudfoundry/cnb:latest"
|
||||
"packeto-buildpacks/cnb:latest"
|
||||
],
|
||||
"RepoDigests": [
|
||||
"cloudfoundry/run@sha256:715806bb793b66e3fc1a5a8f5584c6a1b6db05425e573887673bddcf426f1b90"
|
||||
"packeto-buildpacks/run@sha256:715806bb793b66e3fc1a5a8f5584c6a1b6db05425e573887673bddcf426f1b90"
|
||||
],
|
||||
"Parent": "",
|
||||
"Comment": "",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"status": "Pulling from cloudfoundry/cnb",
|
||||
"id": "bionic"
|
||||
"status": "Pulling from packeto-buildpacks/cnb",
|
||||
"id": "base"
|
||||
}
|
||||
{"status":"Pulling fs layer","progressDetail":{},"id":"5667fdb72017"}
|
||||
{"status":"Pulling fs layer","progressDetail":{},"id":"d83811f270d5"}
|
||||
|
|
@ -595,4 +595,4 @@
|
|||
{"status":"Extracting","progressDetail":{"current":32,"total":32},"progress":"[==================================================\u003e] 32B/32B","id":"4f4fb700ef54"}
|
||||
{"status":"Pull complete","progressDetail":{},"id":"4f4fb700ef54"}
|
||||
{"status":"Digest: sha256:4acb6bfd6c4f0cabaf7f3690e444afe51f1c7de54d51da7e63fac709c56f1c30"}
|
||||
{"status":"Status: Downloaded newer image for cloudfoundry/cnb:bionic"}
|
||||
{"status":"Status: Downloaded newer image for packeto-buildpacks/cnb:base"}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"status": "Status: Downloaded newer image for cloudfoundry/cnb:bionic"
|
||||
"status": "Status: Downloaded newer image for packeto-buildpacks/cnb:base"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"Id": "sha256:9b450bffdb05bcf660d464d0bfdf344ee6ca38e9b8de4f408c8080b0c9319349",
|
||||
"RepoTags": [
|
||||
"cloudfoundry/cnb:latest"
|
||||
"packeto-buildpacks/cnb:latest"
|
||||
],
|
||||
"RepoDigests": [
|
||||
"cloudfoundry/cnb@sha256:915802bb193b66e3fc1a5a8f5584c6a1b6db05425e573887673bddcf426f1b90"
|
||||
"packeto-buildpacks/cnb@sha256:915802bb193b66e3fc1a5a8f5584c6a1b6db05425e573887673bddcf426f1b90"
|
||||
],
|
||||
"Parent": "",
|
||||
"Comment": "",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"status": "Pulling from cloudfoundry/cnb",
|
||||
"id": "bionic"
|
||||
"status": "Pulling from packeto-buildpacks/cnb",
|
||||
"id": "base"
|
||||
}
|
||||
{"status":"Pulling fs layer","progressDetail":{},"id":"5667fdb72017"}
|
||||
{"status":"Pulling fs layer","progressDetail":{},"id":"d83811f270d5"}
|
||||
|
|
@ -595,4 +595,4 @@
|
|||
{"status":"Extracting","progressDetail":{"current":32,"total":32},"progress":"[==================================================\u003e] 32B/32B","id":"4f4fb700ef54"}
|
||||
{"status":"Pull complete","progressDetail":{},"id":"4f4fb700ef54"}
|
||||
{"status":"Digest: sha256:4acb6bfd6c4f0cabaf7f3690e444afe51f1c7de54d51da7e63fac709c56f1c30"}
|
||||
{"status":"Status: Downloaded newer image for cloudfoundry/cnb:bionic"}
|
||||
{"status":"Status: Downloaded newer image for packeto-buildpacks/cnb:base"}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ The following table summarizes the available properties and their default values
|
|||
| `builder`
|
||||
| `--builder`
|
||||
| Name of the Builder image to use.
|
||||
| `cloudfoundry/cnb:bionic-platform-api-0.2`
|
||||
| `gcr.io/paketo-buildpacks/builder:base-platform-api-0.3`
|
||||
|
||||
| `imageName`
|
||||
| `--imageName`
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class BootBuildImageIntegrationTests {
|
|||
String projectName = this.gradleBuild.getProjectDir().getName();
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
|
||||
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api");
|
||||
assertThat(result.getOutput()).contains("paketo-buildpacks/builder");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of(projectName));
|
||||
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
|
||||
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();
|
||||
|
|
@ -77,9 +77,9 @@ class BootBuildImageIntegrationTests {
|
|||
writeLongNameResource();
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImage");
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("example.com/test-image-name");
|
||||
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of("example.com/test-image-name"));
|
||||
assertThat(result.getOutput()).contains("example/test-image-name");
|
||||
assertThat(result.getOutput()).contains("paketo-buildpacks/builder");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of("example/test-image-name"));
|
||||
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
|
||||
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();
|
||||
}
|
||||
|
|
@ -93,11 +93,10 @@ class BootBuildImageIntegrationTests {
|
|||
writeMainClass();
|
||||
writeLongNameResource();
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImage");
|
||||
String projectName = this.gradleBuild.getProjectDir().getName();
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
|
||||
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api-0.2");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of(projectName));
|
||||
assertThat(result.getOutput()).contains("example/test-image-v2");
|
||||
assertThat(result.getOutput()).contains("paketo-buildpacks/builder:base-platform-api-0.2");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of("example/test-image-v2"));
|
||||
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
|
||||
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();
|
||||
}
|
||||
|
|
@ -110,12 +109,12 @@ class BootBuildImageIntegrationTests {
|
|||
void buildsImageWithCommandLineOptions() throws IOException {
|
||||
writeMainClass();
|
||||
writeLongNameResource();
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImage", "--imageName=example.com/test-image-name",
|
||||
"--builder=cloudfoundry/cnb:bionic-platform-api-0.2");
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImage", "--imageName=example/test-image-v2",
|
||||
"--builder=gcr.io/paketo-buildpacks/builder:base-platform-api-0.2");
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("example.com/test-image-name");
|
||||
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api-0.2");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of("example.com/test-image-name"));
|
||||
assertThat(result.getOutput()).contains("example/test-image-v2");
|
||||
assertThat(result.getOutput()).contains("paketo-buildpacks/builder:base-platform-api-0.2");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of("example/test-image-v2"));
|
||||
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
|
||||
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class BootBuildImageTests {
|
|||
|
||||
@Test
|
||||
void whenNoBuilderIsConfiguredThenRequestHasDefaultBuilder() {
|
||||
assertThat(this.buildImage.createRequest().getBuilder().getName()).isEqualTo("cloudfoundry/cnb");
|
||||
assertThat(this.buildImage.createRequest().getBuilder().getName()).isEqualTo("paketo-buildpacks/builder");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ sourceCompatibility = '1.8'
|
|||
targetCompatibility = '1.8'
|
||||
|
||||
bootBuildImage {
|
||||
imageName = "example.com/test-image-name"
|
||||
imageName = "example/test-image-name"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ sourceCompatibility = '1.8'
|
|||
targetCompatibility = '1.8'
|
||||
|
||||
bootBuildImage {
|
||||
builder = "cloudfoundry/cnb:bionic-platform-api-0.2"
|
||||
imageName = "example/test-image-v2"
|
||||
builder = "gcr.io/paketo-buildpacks/builder:base-platform-api-0.2"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ The following table summarizes the available parameters and their default values
|
|||
| `builder`
|
||||
| Name of the Builder image to use.
|
||||
| `spring-boot.build-image.builder`
|
||||
| `cloudfoundry/cnb:bionic-platform-api-0.2`
|
||||
| `gcr.io/paketo-buildpacks/builder:base-platform-api-0.3`
|
||||
|
||||
| `name`
|
||||
| {spring-boot-api}/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||
assertThat(jar).isFile();
|
||||
File original = new File(project, "target/build-image-0.0.1.BUILD-SNAPSHOT.jar.original");
|
||||
assertThat(original).doesNotExist();
|
||||
assertThat(buildLog(project)).contains("Building image").contains("cloudfoundry/cnb:bionic-platform-api")
|
||||
assertThat(buildLog(project)).contains("Building image").contains("paketo-buildpacks/builder")
|
||||
.contains("docker.io/library/build-image:0.0.1.BUILD-SNAPSHOT")
|
||||
.contains("Successfully built image");
|
||||
ImageReference imageReference = ImageReference.of(ImageName.of("build-image"), "0.0.1.BUILD-SNAPSHOT");
|
||||
|
|
@ -93,11 +93,13 @@ public class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||
void whenBuildImageIsInvokedWithCommandLineParameters(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-image").goals("package")
|
||||
.systemProperty("spring-boot.build-image.imageName", "example.com/test/cmd-property-name:v1")
|
||||
.systemProperty("spring-boot.build-image.builder", "cloudfoundry/cnb:bionic-platform-api-0.2")
|
||||
.systemProperty("spring-boot.build-image.builder",
|
||||
"gcr.io/paketo-buildpacks/builder:base-platform-api-0.2")
|
||||
.execute((project) -> {
|
||||
assertThat(buildLog(project)).contains("Building image")
|
||||
.contains("example.com/test/cmd-property-name:v1")
|
||||
.contains("cloudfoundry/cnb:bionic-platform-api-0.2").contains("Successfully built image");
|
||||
.contains("paketo-buildpacks/builder:base-platform-api-0.2")
|
||||
.contains("Successfully built image");
|
||||
ImageReference imageReference = ImageReference.of("example.com/test/cmd-property-name:v1");
|
||||
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
|
||||
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();
|
||||
|
|
@ -112,7 +114,7 @@ public class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||
void whenBuildImageIsInvokedWithV2BuilderImage(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-image-v2-builder").goals("package").execute((project) -> {
|
||||
assertThat(buildLog(project)).contains("Building image")
|
||||
.contains("cloudfoundry/cnb:bionic-platform-api-0.2")
|
||||
.contains("paketo-buildpacks/builder:base-platform-api-0.2")
|
||||
.contains("docker.io/library/build-image-v2-builder:0.0.1.BUILD-SNAPSHOT")
|
||||
.contains("Successfully built image");
|
||||
ImageReference imageReference = ImageReference
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<image>
|
||||
<builder>cloudfoundry/cnb:bionic-platform-api-0.2</builder>
|
||||
<builder>gcr.io/paketo-buildpacks/builder:base-platform-api-0.2</builder>
|
||||
</image>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class ImageTests {
|
|||
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("docker.io/cloudfoundry/cnb:bionic-platform-api");
|
||||
assertThat(request.getBuilder().toString()).contains("paketo-buildpacks/builder");
|
||||
assertThat(request.getEnv()).isEmpty();
|
||||
assertThat(request.isCleanCache()).isFalse();
|
||||
assertThat(request.isVerboseLogging()).isFalse();
|
||||
|
|
|
|||
Loading…
Reference in New Issue