github-actions[bot] commented on code in PR #62665:
URL: https://github.com/apache/doris/pull/62665#discussion_r3121433362


##########
build.sh:
##########
@@ -859,6 +859,76 @@ function build_fe_modules() {
     return 1
 }
 
+function refresh_fe_build_version_if_commit_changed() {
+    [[ -d "${DORIS_HOME}/.git" ]] || return 0

Review Comment:
   Git worktrees store `.git` as a file, not a directory, so this new guard 
silently disables the refresh hook in the worktree setup we explicitly support 
in `AGENTS.md`. That means stale FE version metadata will still reproduce there.
   
   ```suggestion
       git -C "${DORIS_HOME}" rev-parse --is-inside-work-tree >/dev/null 2>&1 
|| return 0
   ```



##########
build.sh:
##########
@@ -859,6 +859,76 @@ function build_fe_modules() {
     return 1
 }
 
+function refresh_fe_build_version_if_commit_changed() {
+    [[ -d "${DORIS_HOME}/.git" ]] || return 0
+
+    local 
version_java="${DORIS_HOME}/fe/fe-common/target/generated-sources/build/org/apache/doris/common/Version.java"
+    local version_class_dir="${DORIS_HOME}/fe/fe-common/target/classes"
+    local 
fe_common_target_jar="${DORIS_HOME}/fe/fe-common/target/doris-fe-common.jar"
+    local version_h="${DORIS_HOME}/gensrc/build/gen_cpp/version.h"
+    local cloud_version_h="${DORIS_HOME}/gensrc/build/gen_cpp/cloud_version.h"
+
+    [[ -f "${version_java}" ]] || return 0
+
+    local current_hash
+    current_hash="$(cd "${DORIS_HOME}" && git log -1 --pretty=format:"%h" 
2>/dev/null || true)"
+    [[ -n "${current_hash}" ]] || return 0
+
+    local baked_hash
+    baked_hash="$(sed -n 's/.*DORIS_BUILD_SHORT_HASH[^"]*"\([^"]*\)".*/\1/p' 
"${version_java}" | head -1)"

Review Comment:
   This is checking the generated `Version.java`, not the packaged `fe-common` 
artifact that FE actually loads at runtime. That misses the cache-hit case this 
PR is targeting: `generated-source.sh` can leave `Version.java` current, while 
Maven build cache restores an old `doris-fe-common.jar`/`fe-common-*.jar` (see 
the note in `fe/.mvn/maven-build-cache-config.xml` about restoring the primary 
JAR artifact on hits). In that scenario `baked_hash == current_hash` here, we 
skip the refresh, and FE still reports the old commit. Please validate the hash 
from the runtime jar/class or always rewrite the packaged jars after the FE 
build.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to