-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Labels
Description
- the main function checks for different environment variables than the
get_git_hash*
functions get_git_hash
checks for the wrong variable compared to mainget_git_hash_short
doesnt even check for the environment variable before trying to run git.
diff --git a/influxdb3_process/build.rs b/influxdb3_process/build.rs
index e4b4f992ff..33343f989b 100644
--- a/influxdb3_process/build.rs
+++ b/influxdb3_process/build.rs
@@ -15,7 +15,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
fn get_git_hash() -> String {
- let out = match std::env::var("VERSION_HASH") {
+ let out = match std::env::var("GIT_HASH") {
Ok(v) => v,
Err(_) => {
let output = Command::new("git")
@@ -32,9 +32,17 @@ fn get_git_hash() -> String {
}
fn get_git_hash_short() -> String {
- let output = Command::new("git")
- .args(["rev-parse", "--short", "HEAD"])
- .output()
- .expect("failed to execute git rev-parse to read the current git hash");
- String::from_utf8(output.stdout).expect("non-utf8 found in git hash")
+ let out = match std::env::var("GIT_HASH_SHORT") {
+ Ok(v) => v,
+ Err(_) => {
+ let output = Command::new("git")
+ .args(["rev-parse", "--short", "HEAD"])
+ .output()
+ .expect("failed to execute git rev-parse to read the current git hash");
+ String::from_utf8(output.stdout).expect("non-utf8 found in git hash")
+ }
+ };
+
+ assert!(!out.is_empty(), "attempting to embed empty git hash");
+ out
}