Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use wildcard in BP_JVM_VERSION with image building #22916

Closed
schnatterer opened this issue Aug 12, 2020 · 3 comments
Closed

Use wildcard in BP_JVM_VERSION with image building #22916

schnatterer opened this issue Aug 12, 2020 · 3 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@schnatterer
Copy link

Setting a non-wildcard JVM version for an OCI image via the BP_JVM_VERSION env var in the maven or gradle plugin (as proposed in the docs) will lead to failing builds, if the the JVM version is not the most recent version.
So it might work in the beginning when setting the current version, but once a newer version is out (leading to a new builder version) the build will fail.
See paketo-buildpacks/bellsoft-liberica#8.

I would have created a PR for the docs, but I'm not quite sure what the best solution is.

Pinning the builder image would work but it's a bit cumbersome to find out a builder version.
What I came up with is this, but it's really not straightforward:

reg tags gcr.io/paketo-buildpacks/builder | grep base-platform-api

At the moment this results in gcr.io/paketo-buildpacks/builder:0.0.429-base-platform-api-0.3.
But then how to find out the matching JVM version? Again, not straightforward:

skopeo inspect docker://gcr.io/paketo-buildpacks/builder:0.0.429-base-platform-api-0.3 | grep bellsoft-liberica

And then look up JDK version in release, e.g. here: https://github.com/paketo-buildpacks/bellsoft-liberica/releases/tag/v2.13.0

So just delete the paragraph about BP_JVM_VERSION?
Any other ideas?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 12, 2020
@wilkinsona
Copy link
Member

wilkinsona commented Aug 12, 2020

Switching to a wildcard as @nebhale suggests in paketo-buildpacks/bellsoft-liberica#8 seems like the best bet to me.

@scottfrederick scottfrederick added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 12, 2020
@scottfrederick scottfrederick added this to the 2.3.x milestone Aug 12, 2020
@scottfrederick scottfrederick self-assigned this Aug 12, 2020
@scottfrederick scottfrederick changed the title Maven/Gradle Plugin docs: Specifying non-wildcard BP_JVM_VERSION is bound to lead to failing builds Use wildcard in BP_JVM_VERSION with image building Aug 12, 2020
@scottfrederick scottfrederick modified the milestones: 2.3.x, 2.3.3 Aug 12, 2020
@schnatterer
Copy link
Author

Thanks @wilkinsona and @scottfrederick.
For people looking for a way to get deterministic builds it might be helpful to know that the JDK version can be pinned via the builder. For example by setting a gcr.io/paketo-buildpacks/builder:0.0.429-base-platform-api-0.3 as builder.

Would this be a helpful addition to the docs?

@scottfrederick
Copy link
Contributor

@schnatterer Spring Boot uses the Paketo builder by default, but users can choose to use other builders and buildpacks instead. For this reason we try to keep the Boot docs from containing details that are specific to the way Paketo does things. We chose to use BP_JVM_VERSION as an example of setting an environment variable for a builder because it's something people are likely to want to do, but we also qualified that example with The following example assumes that the default builder defines a BP_JVM_VERSION property ... to try to make it clear that it is dependent on the builder being used. As you've seen, this simple example has required a small amount of effort to stay in sync with Paketo recommendations and docs.

This technique for pinning the JDK/JRE version by pinning the builder version looks like something that is better left to the Paketo documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

4 participants