[go-migration] Compatibility issue with existing apps due to JRE relocation in the Go-based Java Buildpack
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 领域
- build-system
调研方向
从 issue 中提到的 buildpack staging 流程和 /profile.d/0_java.sh 入口点开始,然后跟踪新的 JAVA_HOME 在哪里建立。使用硬编码的 .java-buildpack/open_jdk_jre/bin/java 路径重现 staging,并验证两个旧版 JRE 路径都解析到规范位置,同时新的 JAVA_HOME 仍然可用。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
With the new Go-based Java Buildpack, the location of the JRE has changed:
for example, from /home/vcap/app/.java-buildpack/open_jdk_jre to the new location /home/vcap/deps/0/jre/jre-17.0.15/.
There are applications that invoke Java via a hardcoded relative path inside the droplet: .java-buildpack/open_jdk_jre/bin/java so those hardcoded paths no longer exist, which breaks apps and CF tasks that rely on that path. For example, an app used to execute CF Task to execute e.g. the DB schema (so the java is currently being invoked via the full path .java-buildpack/open_jdk_jre/bin/java). Or usages like JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS="-Djava.io.tmpdir=$TMPDIR
The new Go-based buildpack has a way to introduce $JAVA_HOME which will do the job but only for new apps (the existing apps pointing to /home/vcap/app/.java-buildpack/open_jdk_jre will fail).
Reproduction steps
- Use an app/script that calls Java using the relative path inside the droplet, e.g.:
.java-buildpack/open_jdk_jre/bin/java -Xms123M org.springframework.boot.loader.launch.JarLauncher - Stage the app using the current or the Go-migration branch of the buildpack.
- Run the app or run a CF task that invokes the hardcoded path.
- Observe that the app fails with
No such file or directory
Expected behavior
Existing apps/CF Tasks could continue to run without modification, even if the buildpack internal JRE layout changes.
Suggested solution
Introduce compatibility shims during staging:
export JAVA_HOME=<the-new-java-location> (available in /profile.d/0_java.sh)
mkdir -p /home/vcap/app/.java-buildpack
ln -s $JAVA_HOME /home/vcap/app/.java-buildpack/open_jdk_jre
ln -s $JAVA_HOME /home/vcap/app/.java-buildpack/sap_machine_jre
- This preserves
.java-buildpack/open_jdk_jreand.java-buildpack/sap_machine_jreas a symlink to the actual JRE location. $JAVA_HOMEpoints to the canonical new location.- Apps with hard-coded paths will continue working.
- 主要语言
- Go
- 星标
- 452
- 派生
- 2.5k
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 20
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudfoundry/java-buildpack 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 68/100
cloudfoundry/java-buildpack#1423 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
cloudfoundry/java-buildpack#1377 · 5 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
cloudfoundry/java-buildpack#1364 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
cloudfoundry/java-buildpack#1342 · 1 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
查看 cloudfoundry/java-buildpack 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
AOSSIE-Org/DebateAI#611 ·
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
terraform-provider
难度 2/5 1-3 小时 新手友好度 73/100
ClickHouse/terraform-provider-clickhousedbops#281 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
open-telemetry/opentelemetry-go-compile-instrumentation#1450 ·
维护者通常 2 天内回复