-
Notifications
You must be signed in to change notification settings - Fork 26
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
Set JAVA_VERSION and/or JAVA_HOME so that skaffold debug works #33
Comments
BTW, I'm pretty sure this used to work in the summer. I was quite surprised it didn't work out of the box today because I've used it before in workshops (e.g. at Spring One). |
@dsyer Given our discussion earlier, is this still an open issue for you? |
Yes. This is somewhat unrelated. I still have to set JAVA_VERSION manually in my podspec to get the debugger to work. |
Just as a heads up to you guys. Built an image last night with current buildpack and Spring version 2.3.5/java 11 and the JAVA_HOME is still not set which is a bit of a pain when one needs to execute some standard tools on container startup. |
@dsyer @mydogspies - Hi, is this something that you're still having issues with? The Java buildpack should be setting Please let me know if it's still presenting issues. Thanks! |
I see JAVA_HOME but no JAVA_VERSION or JAVA_TOOL_OPTIONS (which are the two things |
How does |
JAVA_TOOL_OPTIONS is not set if I func (t jdwpTransformer) IsApplicable(config ImageConfiguration) bool {
if _, found := config.Env["JAVA_TOOL_OPTIONS"]; found {
return true
}
if _, found := config.Env["JAVA_VERSION"]; found {
return true
}
if len(config.Entrypoint) > 0 && !isEntrypointLauncher(config.Entrypoint) {
return config.Entrypoint[0] == "java" || strings.HasSuffix(config.Entrypoint[0], "/java")
}
return len(config.Arguments) > 0 &&
(config.Arguments[0] == "java" || strings.HasSuffix(config.Arguments[0], "/java"))
} UPDATE: I was wrong. My container is crashing so I never get to see JAVA_TOOL_OPTIONS. |
You have to invoke the launcher if you want to test like this. The launcher is what sets up the environment at runtime. https://buildpacks.io/docs/app-developer-guide/run-an-app/#user-provided-shell-process
I took a look at that link, from what I see in the comments it's pulling the env from the OCI image. That would make sense why it's not finding it. That buildpack images don't have that set on the image.
The env variables are set by the launcher when the image is run. I don't think there's anything we can do as buildpack authors to change that behavior. It's just how buildpacks work. In addition, buildpacks doesn't set any arguments so the last check they are doing isn't going to work either. I think we might be able to make the entry point check pass though. It's looking for an entry point with
A buildpack is going to have an entry point set to the process type that should run. We can control the process type name, so we could have one that is The easiest way to try this would be to add a Ex:
If that works, we can explore making that easier. The executable-jar CNB adds some process types, just not one called There are possibly other ways we could trigger setting |
It wouldn't work if you use Spring Boot to build the image (spring-projects/spring-boot#6626 (comment)). I guess if you use |
OK, I was hoping we could use Profile to just test this and see if it works when we add that additional entrypoint. Since that doesn't look like it'll be an option, I can hack together a test version of executable-jar that adds in the additional entrypoint. Give me a little time and I'll get you an image you can try. I just want to make sure skaffold does what we expect it to when the entrypoint has the name
No, not that I've seen. That is a pack-specific cli argument. It doesn't look like the Boot integration has a similar option. That could be a problem to making this work as well. |
If you just need a proof of concept I can try and craft something with |
It's funny, I can't find a way to make skaffold fail to debug now. So that PoC is redundant. I think maybe the CNB features of skaffold have improved and it recognizes the Java container that way. We should close this. |
Well, that's good news! Thanks for the update. If you see weirdness in the future, just let us know. |
Skaffold has a neat debug feature, but it doesn't work with buildpack images because it tries to detect a Java application and fails. It looks for environment variables and also the entrypoint of the container (but that doesn't show any sign of being Java related in a buildpack image): https://github.com/GoogleContainerTools/skaffold/blob/master/pkg/skaffold/debug/transform_jvm.go#L39-L53.
The text was updated successfully, but these errors were encountered: