Fix pointing exact version with BP_JAVA_VERSION#1358
Conversation
stokpop
left a comment
There was a problem hiding this comment.
Thanks for the PR! Have made some notes.
| } | ||
| // Exact patch version (e.g. "17.0.13") — already fully specified, don't append ".*" | ||
| // which would produce an unmatchable pattern like "17.0.13.*". | ||
| exactVersionRegex := regexp.MustCompile(`^\d+\.\d+\.\d+$`) |
There was a problem hiding this comment.
Although this code is probably not on a hot path, you can also hoist regexes so its no compiled for each call, e.g.
var threePartVersionPattern = regexp.MustCompile(`^\d+\.\d+\.\d+$`)
func isValidVersion(version string) bool {
return threePartVersionPattern.MatchString(version)
}
There was a problem hiding this comment.
extracted as proposed
| }) | ||
|
|
||
| It("resolves exact patch version", func() { | ||
| os.Setenv("BP_JAVA_VERSION", "17.0.13") |
There was a problem hiding this comment.
The basic fix probably works as far as I can tell, but the actual versions of JRE are like: X.Y.Z+W format (17.0.19+11). Consider adding a test where BP_JAVA_VERSION resolves against a manifest entry 17.0.19+11.
I also thought we use "JBP_CONFIG_OPEN_JDK_JRE: '{ jre: { version: "25.0.3" } }'", I assume the fix also works for those cases, but maybe also add test case to be sure.
There was a problem hiding this comment.
added also a test for JBP_CONFIG_OPEN_JDK_JRE: '{ jre: {version: "17.0.19+11"} }'"
Fixes #1338
When specifying an exact version for
BP_JAVA_VERSION, staging fails: