Skip to content

Fix pointing exact version with BP_JAVA_VERSION#1358

Open
kiril-keranov wants to merge 2 commits into
mainfrom
fix_1338
Open

Fix pointing exact version with BP_JAVA_VERSION#1358
kiril-keranov wants to merge 2 commits into
mainfrom
fix_1338

Conversation

@kiril-keranov

@kiril-keranov kiril-keranov commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #1338
When specifying an exact version for BP_JAVA_VERSION, staging fails:

2026-07-10T17:10:30.21+0300 [STG/0] OUT **WARNING** Could not find openjdk matching version 17.0.19.*: improper constraint: 17.0.19.*
2026-07-10T17:10:30.21+0300 [STG/0] OUT **ERROR** Failed to install JRE: failed to determine OpenJDK version from manifest: no version of openjdk matching 17.0.19.* found

@kiril-keranov kiril-keranov requested a review from stokpop July 10, 2026 14:17

@stokpop stokpop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Have made some notes.

Comment thread src/java/jres/jre.go
}
// 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+$`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
}

Comment thread src/java/jres/jre_test.go
})

It("resolves exact patch version", func() {
os.Setenv("BP_JAVA_VERSION", "17.0.13")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BP_JAVA_VERSION with exact patch version (e.g. 17.0.13) silently fails

2 participants