Skip to content

Commit

Permalink
Upgrade default CNB builders to Paketo Jammy
Browse files Browse the repository at this point in the history
Closes gh-36689
  • Loading branch information
scottfrederick committed Aug 14, 2023
1 parent 2ef2529 commit eb45aab
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ resources:
type: registry-image
icon: docker
source:
repository: paketobuildpacks/builder
tag: base
repository: paketobuildpacks/builder-jammy-base
tag: latest
- name: artifactory-repo
type: artifactory-resource
icon: package-variant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ This means you can just type a single command and quickly get a sensible image i
The resulting image doesn't contain a JVM, instead the native image is compiled statically.
This leads to smaller images.

NOTE: The builder used for the images is `paketobuildpacks/builder:tiny`.
It has small footprint and reduced attack surface, but you can also use `paketobuildpacks/builder-jammy-base` or `paketobuildpacks/builder-jammy-full` to have more tools available in the image if required.
NOTE: The builder used for the images is `paketobuildpacks/builder-jammy-tiny:latest`.
It has small footprint and reduced attack surface, but you can also use `paketobuildpacks/builder-jammy-base:latest` or `paketobuildpacks/builder-jammy-full:latest` to have more tools available in the image if required.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ publishing.publications.withType(MavenPublication) {
delegate.artifactId('spring-boot-maven-plugin')
configuration {
image {
delegate.builder("paketobuildpacks/builder:tiny");
delegate.builder("paketobuildpacks/builder-jammy-tiny:latest");
env {
delegate.BP_NATIVE_IMAGE("true")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
public class BuildRequest {

static final String DEFAULT_BUILDER_IMAGE_NAME = "paketobuildpacks/builder:base";
static final String DEFAULT_BUILDER_IMAGE_NAME = "paketobuildpacks/builder-jammy-base:latest";

private static final ImageReference DEFAULT_BUILDER = ImageReference.of(DEFAULT_BUILDER_IMAGE_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The following table summarizes the available properties and their default values
| `builder`
| `--builder`
| Name of the Builder image to use.
| `paketobuildpacks/builder:base` or `paketobuildpacks/builder:tiny` when {nbt-gradle-plugin}[GraalVM Native Image plugin] is applied.
| `paketobuildpacks/builder-jammy-base:latest` or `paketobuildpacks/builder-jammy-tiny:latest` when {nbt-gradle-plugin}[GraalVM Native Image plugin] is applied.

| `runImage`
| `--runImage`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ When the {nbt-gradle-plugin}[GraalVM Native Image plugin] is applied to a projec
. Configures the GraalVM extension to disable Toolchain detection.
. Configures each GraalVM native binary to require GraalVM 22.3 or later.
. Configures the `bootJar` task to include the reachability metadata produced by the `collectReachabilityMetadata` task in its jar.
. Configures the `bootBuildImage` task to use `paketobuildpacks/builder:tiny` as its builder and to set `BP_NATIVE_IMAGE` to `true` in its environment.
. Configures the `bootBuildImage` task to use `paketobuildpacks/builder-jammy-tiny:latest` as its builder and to set `BP_NATIVE_IMAGE` to `true` in its environment.


Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void configureBootBuildImageToProduceANativeImage(Project project) {
project.getTasks()
.named(SpringBootPlugin.BOOT_BUILD_IMAGE_TASK_NAME, BootBuildImage.class)
.configure((bootBuildImage) -> {
bootBuildImage.getBuilder().convention("paketobuildpacks/builder:tiny");
bootBuildImage.getBuilder().convention("paketobuildpacks/builder-jammy-tiny:latest");
bootBuildImage.getEnvironment().put("BP_NATIVE_IMAGE", "true");
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ void bootBuildImageIsConfiguredToBuildANativeImage() {
writeDummySpringApplicationAotProcessorMainClass();
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.2-rc-1")
.build("bootBuildImageConfiguration");
assertThat(result.getOutput()).contains("paketobuildpacks/builder:tiny").contains("BP_NATIVE_IMAGE = true");
assertThat(result.getOutput()).contains("paketobuildpacks/builder-jammy-tiny")
.contains("BP_NATIVE_IMAGE = true");
}

@TestTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ void whenUsingDefaultConfigurationThenRequestHasPublishDisabled() {

@Test
void whenNoBuilderIsConfiguredThenRequestHasDefaultBuilder() {
assertThat(this.buildImage.createRequest().getBuilder().getName()).isEqualTo("paketobuildpacks/builder");
assertThat(this.buildImage.createRequest().getBuilder().getName())
.isEqualTo("paketobuildpacks/builder-jammy-base");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ The following table summarizes the available parameters and their default values
| `builder` +
(`spring-boot.build-image.builder`)
| Name of the Builder image to use.
| `paketobuildpacks/builder:base`
| `paketobuildpacks/builder-jammy-base:latest`

| `runImage` +
(`spring-boot.build-image.runImage`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void getBuildRequestWhenNameIsSetUsesName() {
void getBuildRequestWhenNoCustomizationsUsesDefaults() {
BuildRequest request = new Image().getBuildRequest(createArtifact(), mockApplicationContent());
assertThat(request.getName()).hasToString("docker.io/library/my-app:0.0.1-SNAPSHOT");
assertThat(request.getBuilder().toString()).contains("paketobuildpacks/builder");
assertThat(request.getBuilder().toString()).contains("paketobuildpacks/builder-jammy-base");
assertThat(request.getRunImage()).isNull();
assertThat(request.getEnv()).isEmpty();
assertThat(request.isCleanCache()).isFalse();
Expand Down

0 comments on commit eb45aab

Please sign in to comment.