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:
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user