paketo-buildpacks / bellsoft-liberica

A Cloud Native Buildpack that provides the Bellsoft Liberica implementations of JREs and JDKs
Apache License 2.0
74 stars 18 forks source link

Support JDK 22 #565

Closed lazystone closed 7 months ago

lazystone commented 8 months ago
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 100%
[INFO]  > Pulled builder image 'docker.io/paketobuildpacks/builder-jammy-base@sha256:a913462b288209172cb7626c2ded55843002a7aa1a6bc87e9af52be1ab5511fc'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run-jammy-base:latest' 100%
[INFO]  > Pulled run image 'docker.io/paketobuildpacks/run-jammy-base@sha256:8431203470391fc58454b71bdb917f53c20f403892fbb447f4ea5265a8d7cf49'
[INFO]  > Executing lifecycle version v0.19.0
[INFO]  > Using build cache volume 'pack-cache-d59660a7b02b.build'
[INFO] 
[INFO]  > Running creator
[INFO]     [creator]     ===> ANALYZING
[INFO]     [creator]     Restoring data for SBOM from previous image
[INFO]     [creator]     ===> DETECTING
[INFO]     [creator]     7 of 26 buildpacks participating
[INFO]     [creator]     paketo-buildpacks/ca-certificates       3.6.8
[INFO]     [creator]     paketo-buildpacks/bellsoft-liberica     10.5.3
[INFO]     [creator]     paketo-buildpacks/syft                  1.45.0
[INFO]     [creator]     paketo-buildpacks/executable-jar        6.8.4
[INFO]     [creator]     paketo-buildpacks/dist-zip              5.6.9
[INFO]     [creator]     paketo-buildpacks/spring-boot           5.27.10
[INFO]     [creator]     paketo-buildpacks/environment-variables 4.5.7
[INFO]     [creator]     ===> RESTORING
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/ca-certificates:helper" from app image
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/bellsoft-liberica:jre" from app image
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/bellsoft-liberica:helper" from app image
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/bellsoft-liberica:java-security-properties" from app image
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/syft:syft" from cache
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/spring-boot:web-application-type" from app image
[INFO]     [creator]     Restoring metadata for "paketo-buildpacks/environment-variables:environment-variables" from app image
[INFO]     [creator]     Restoring data for "paketo-buildpacks/syft:syft" from cache
[INFO]     [creator]     Restoring data for SBOM from cache
[INFO]     [creator]     ===> BUILDING
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for CA Certificates 3.6.8
[INFO]     [creator]       https://github.com/paketo-buildpacks/ca-certificates
[INFO]     [creator]       Launch Helper: Contributing to layer
[INFO]     [creator]         Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for BellSoft Liberica 10.5.3
[INFO]     [creator]       https://github.com/paketo-buildpacks/bellsoft-liberica
[INFO]     [creator]       Build Configuration:
[INFO]     [creator]         $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
[INFO]     [creator]         $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
[INFO]     [creator]         $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
[INFO]     [creator]         $BP_JVM_VERSION              22                                                           the Java version
[INFO]     [creator]       Launch Configuration:
[INFO]     [creator]         $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
[INFO]     [creator]         $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
[INFO]     [creator]         $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
[INFO]     [creator]         $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
[INFO]     [creator]         $BPL_JAVA_NMT_ENABLED        false                                                        enables Java Native Memory Tracking (NMT)
[INFO]     [creator]         $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
[INFO]     [creator]         $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
[INFO]     [creator]         $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
[INFO]     [creator]         $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
[INFO]     [creator]         $BPL_JMX_PORT                5000                                                         configure the JMX port
[INFO]     [creator]         $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
[INFO]     [creator]         $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
[INFO]     [creator]         $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[INFO]     [creator]         $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[INFO]     [creator]         Using Java version 22 from BP_JVM_VERSION
[INFO]     [creator]       No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
[INFO]     [creator]        : Contributing to layer
[INFO]     [creator]       Warning: Dependency has no SHA256. Skipping cache.
[INFO]     [creator]         Downloading from 
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to get dependency 
[INFO]     [creator]     unable to download 
[INFO]     [creator]     unable to request 
[INFO]     [creator]     Get "": unsupported protocol scheme ""
[INFO]     [creator]     ERROR: failed to build: exit status 1

JDK 22 is available for download: https://bell-sw.com/pages/downloads/#jdk-22

KafkaProServerless commented 8 months ago

Hello team,

It would be great if the support for JDK 22 can be made available

Thank you

anthonydahanne commented 8 months ago

Hello! I am sorry we haven't added Java 22 yet to Bellsoft Liberica. We're in the middle of implementing a long awaited feature for Paketo Buildpacks: arm64 support - and we'd like to make sure it's not breaking any existing builds before we make it the default.

What's the link to Java 22? Well, currently latest bellsoft-liberica is dualarch and we'd like to add Java 22 support directly to the main branch (on top of dual arch); instead of temporarily branching (from before dualarch) just for Java 22.

I know it's probably not the answer you were expecting, but as a way to "workaround" it, would you be ok if we added Java 22 to another JVM buildpack, such as azul-zulu which is not dual branch yet, hence, not in "artificial freeze"

Please let me know, Thanks

juergenzimmermann commented 8 months ago

@anthonydahanne It would be fine to have azul-zulu 22 as a temporary workaround.

KafkaProServerless commented 7 months ago

Hello team, would it be possible to have a workaround while you guys are working on the arm64 support?

anthonydahanne commented 7 months ago

hello all! so, this is not the solution, but a workaround, using Azul Zulu, while we figure things out with Java 22 and multi arch (should be fine though; I'll update the issue when we have something)

Using Maven and Spring Boot Plugin, that could look like this:

                         <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <image>
                        <env>
                            <BP_JVM_VERSION>22</BP_JVM_VERSION>
                        </env>
                        <buildpacks>
                            <buildpack>paketobuildpacks/azul-zulu</buildpack>
                            <buildpack>urn:cnb:builder:paketo-buildpacks/syft</buildpack>
                            <buildpack>urn:cnb:builder:paketo-buildpacks/executable-jar</buildpack>
                            <buildpack>urn:cnb:builder:paketo-buildpacks/spring-boot</buildpack>
                        </buildpacks>
                        <builder>paketobuildpacks/builder-jammy-base</builder>
                    </image>
                </configuration>
            </plugin>

and then at build time

[INFO]     [creator]         Using Java version 22 from BP_JVM_VERSION
[INFO]     [creator]       Azul Zulu JRE 22.0.0: Contributing to layer
[INFO]     [creator]         Downloading from https://cdn.azul.com/zulu/bin/zulu22.28.91-ca-jre22.0.0-linux_x64.tar.gz

and then at runtime

2024-04-10T16:09:15.726Z  INFO 1 --- [           main] io.paketo.demo.DemoApplication           : Starting DemoApplication v0.0.1-SNAPSHOT using Java 22 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
KafkaProServerless commented 7 months ago

I am seeing this error instead.

May I ask what did I do wrong?

[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 69%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder-jammy-base@sha256:32960549a83d6bd8e2c3504cde90af7082bc1f329cc03423e65ed5f815f69651'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run-jammy-base:latest' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run-jammy-base@sha256:436a84a3ae3bdbc9f0534b7e6a80122d05f734048137691fcfec36f8132758b1'
[INFO]  > Pulling buildpack image 'docker.io/paketobuildpacks/azul-zulu:latest' 100%
[INFO]  > Pulled buildpack image 'paketobuildpacks/azul-zulu@sha256:12173bb3488daf086700fae81acaadbc05936cf84fd35abaf907195ee05ad979'
[INFO]  > Executing lifecycle version v0.19.3
[INFO]  > Using build cache volume 'pack-cache-0fbf249b0dea.build'
[INFO] 
[INFO]  > Running creator
[INFO]     [creator]     ===> ANALYZING
[INFO]     [creator]     Image with name "docker.io/library/myapp:1.1" not found
[INFO]     [creator]     ===> DETECTING
[INFO]     [creator]     ======== Output: paketo-buildpacks/executable-jar@6.8.5 ========
[INFO]     [creator]       Build Configuration:
[INFO]     [creator]         $BP_EXECUTABLE_JAR_LOCATION         a glob specifying which jar files should be used
[INFO]     [creator]         $BP_LIVE_RELOAD_ENABLED      false  enable live process reload in the image
[INFO]     [creator]     PASSED: 'Main-Class' manifest attribute found
[INFO]     [creator]     ======== Output: paketo-buildpacks/spring-boot@5.27.11 ========
[INFO]     [creator]         Spring-Boot-Native-Processed MANIFEST entry was detected, activating native image
[INFO]     [creator]     ======== Results ========
[INFO]     [creator]     pass: paketo-buildpacks/azul-zulu@10.3.0
[INFO]     [creator]     pass: paketo-buildpacks/syft@1.45.0
[INFO]     [creator]     pass: paketo-buildpacks/executable-jar@6.8.5
[INFO]     [creator]     pass: paketo-buildpacks/spring-boot@5.27.11
[INFO]     [creator]     Resolving plan... (try #1)
[INFO]     [creator]     fail: paketo-buildpacks/azul-zulu@10.3.0 provides unused native-image-builder
[INFO]     [creator]     Resolving plan... (try #2)
[INFO]     [creator]     fail: paketo-buildpacks/executable-jar@6.8.5 requires jre
[INFO]     [creator]     Resolving plan... (try #3)
[INFO]     [creator]     fail: paketo-buildpacks/spring-boot@5.27.11 provides unused native-processed
[INFO]     [creator]     Resolving plan... (try #4)
[INFO]     [creator]     fail: paketo-buildpacks/executable-jar@6.8.5 requires jre
[INFO]     [creator]     Resolving plan... (try #5)
[INFO]     [creator]     fail: paketo-buildpacks/spring-boot@5.27.11 provides unused native-processed
[INFO]     [creator]     ERROR: No buildpack groups passed detection.
[INFO]     [creator]     ERROR: Please check that you are running against the correct path.
[INFO]     [creator]     ERROR: failed to detect: no buildpacks participating
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:04 min
[INFO] Finished at: 2024-04-11T09:29:00Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.2.4:build-image (default-cli) on project myapp: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.2.4:build-image failed: Builder lifecycle 'creator' failed with status code 20 -> [Help 1]
KafkaProServerless commented 7 months ago

Could you please help @anthonydahanne ?

anthonydahanne commented 7 months ago

Java 22 support released in latest / 10.7

anthonydahanne commented 7 months ago

@KafkaProServerless I'm not sure what's wrong with your build, apparently you provided a JAR supposed to be built with native-image but in your chain of buildpacks, there's no native-image

I suggest you rather go ask further questions on Slack, since it's not related to this issue (unless it's Java 22 specific, but it does not seem to be the case)

bjornharvold commented 1 month ago

This happened today. Thoughts?

Has been running with JDK 22 fine until today's build:

[INFO] --- spring-boot:3.3.4:build-image (default-cli) @ sso-app ---
[INFO] Building image 'docker.io/library/sso-app:30.5.14-SNAPSHOT'
[INFO] 
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder-jammy-base@sha256:e6abf6728e1e79c720a432e7176e53404705e76bbededbdf66fa852fe8ee5a70'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run-jammy-base:latest' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run-jammy-base@sha256:2c17b86a82bb3cb36dbe1c5831f09a9b28faa6b9d2cba5ff62024e69f6a6bf39'
[INFO]  > Executing lifecycle version v0.20.3
[INFO]  > Using build cache volume 'pack-cache-da8c19204809.build'
[INFO] 
[INFO]  > Running creator
[INFO]     [creator]     ===> ANALYZING
[INFO]     [creator]     Image with name "docker.io/library/sso-app:30.5.14-SNAPSHOT" not found
[INFO]     [creator]     ===> DETECTING
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     7 of 26 buildpacks participating
[INFO]     [creator]     paketo-buildpacks/ca-certificates       3.8.6
[INFO]     [creator]     paketo-buildpacks/bellsoft-liberica     10.9.0
[INFO]     [creator]     paketo-buildpacks/syft                  2.1.0
[INFO]     [creator]     paketo-buildpacks/executable-jar        6.11.3
[INFO]     [creator]     paketo-buildpacks/dist-zip              5.8.5
[INFO]     [creator]     paketo-buildpacks/spring-boot           5.31.2
[INFO]     [creator]     paketo-buildpacks/environment-variables 4.7.3
[INFO]     [creator]     ===> RESTORING
[INFO]     [creator]     ===> BUILDING
[INFO]     [creator]     target distro name/version labels not found, reading /etc/os-release file
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for CA Certificates 3.8.6
[INFO]     [creator]       https://github.com/paketo-buildpacks/ca-certificates
[INFO]     [creator]       Build Configuration:
[INFO]     [creator]         $BP_EMBED_CERTS                    false  Embed certificates into the image
[INFO]     [creator]         $BP_ENABLE_RUNTIME_CERT_BINDING    true   Deprecated: Enable/disable certificate helper layer to add certs at runtime
[INFO]     [creator]         $BP_RUNTIME_CERT_BINDING_DISABLED  false  Disable certificate helper layer to add certs at runtime
[INFO]     [creator]       Launch Helper: Contributing to layer
[INFO]     [creator]         Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for BellSoft Liberica 10.9.0
[INFO]     [creator]       https://github.com/paketo-buildpacks/bellsoft-liberica
[INFO]     [creator]       Build Configuration:
[INFO]     [creator]         $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
[INFO]     [creator]         $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
[INFO]     [creator]         $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
[INFO]     [creator]         $BP_JVM_VERSION              22                                                           the Java version
[INFO]     [creator]       Launch Configuration:
[INFO]     [creator]         $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
[INFO]     [creator]         $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
[INFO]     [creator]         $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
[INFO]     [creator]         $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
[INFO]     [creator]         $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
[INFO]     [creator]         $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
[INFO]     [creator]         $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
[INFO]     [creator]         $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
[INFO]     [creator]         $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
[INFO]     [creator]         $BPL_JMX_PORT                5000                                                         configure the JMX port
[INFO]     [creator]         $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
[INFO]     [creator]         $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
[INFO]     [creator]         $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[INFO]     [creator]         $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[INFO]     [creator]         Using Java version 22 from BP_JVM_VERSION
[INFO]     [creator]       No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
[INFO]     [creator]        : Contributing to layer
[INFO]     [creator]       Warning: Dependency has no SHA256. Skipping cache.
[INFO]     [creator]         Downloading from 
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to get dependency . see DEBUG log level
[INFO]     [creator]     ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.887 s
[INFO] Finished at: 2024-10-05T13:49:37+07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.3.4:build-image (default-cli) on project sso-app: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.3.4:build-image failed: Builder lifecycle 'creator' failed with status code 51 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
➜  sso-app git:(develop) ✗ mvn clean spring-boot:build-image -Pstaging -DskipTests
bjornharvold commented 1 month ago

Doing the workaround as outlined here did make it work again: https://github.com/paketo-buildpacks/bellsoft-liberica/issues/565#issuecomment-2047948648. Very strange because this has been working for months prior without any issues.

lazystone commented 1 month ago

Support for Java 22 is EOL, move to Java 23.

See https://github.com/paketo-buildpacks/bellsoft-liberica/pull/720

dmikusa commented 1 month ago

If you need Java 22 for a bit longer, you can pin to https://github.com/paketo-buildpacks/bellsoft-liberica/releases/tag/v10.8.4.