-
Notifications
You must be signed in to change notification settings - Fork 235
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
fix(ci): add sanity check to build.rs scripts, fixed "detected dubious ownership in repository" errors on git
#4986
Conversation
CodSpeed Performance ReportMerging #4986 will not alter performanceComparing Summary
|
WASM Query Engine file Size
|
git
fn store_git_commit_hash() { | ||
let output = Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap(); | ||
|
||
// Sanity check on the output. | ||
if !output.status.success() { | ||
panic!( | ||
"Failed to get git commit hash.\nstderr: \n{}\nstdout {}\n", | ||
String::from_utf8(output.stderr).unwrap_or_default(), | ||
String::from_utf8(output.stdout).unwrap_or_default(), | ||
); | ||
} | ||
|
||
let git_hash = String::from_utf8(output.stdout).unwrap(); | ||
println!("cargo:rustc-env=GIT_HASH={git_hash}"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would be nicer to have this defined once in some kind of build utils crate that these three crates will depend on as a build dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the whole store_git_commit_hash
could be abstracted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit postponed to https://github.com/prisma/team-orm/issues/1261
Follow-up to #4986. * Change the `build.rs` scripts to pass through the `GIT_HASH` environment variable if it's already set. * Set dummmy `GIT_HASH` value in the Nix packages used in the engines size dashboard. * Consistently use the new logic everywhere. Fixes: #4991 Closes: prisma/team-orm#1261
…4992) Follow-up to #4986. * Change the `build.rs` scripts to pass through the `GIT_HASH` environment variable if it's already set. * Set dummmy `GIT_HASH` value in the Nix packages used in the engines size dashboard. * Consistently use the new logic everywhere. Fixes: #4991 Closes: prisma/team-orm#1261
This PR checks that
git rev-parse HEAD
, the CLI command used at compilation time to store the hash in the Query Engine and Schema Engine, exits successfully.It also complements #4947 by running
git config --global --add safe.directory /root/build
when cross-building viaprismagraphql/build:*
. This avoids "fatal: detected dubious ownership in repository at /root/build" errors in Linux Musl ARM64 and Linux Static ARM64 architectures.This was introduced after third-party clients notified us that
./query-engine --version
no longer displayed the version hash in Linux Alpine.Fixes: prisma/prisma#25020
Fixes: prisma/prisma#24971