-
Notifications
You must be signed in to change notification settings - Fork 13
WIP: feat: hermetic build for enola #1730 (custom-hermetic-build) #1794
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @dotdoom, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant changes to the Nix build definition for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a hermetic Nix build for the enola package by implementing a two-phase build process. This is a significant improvement for build reproducibility. The review identifies a couple of issues with the implementation. First, there are some redundant dependencies in the nativeBuildInputs of the main derivation. More critically, the buildPhase of the main derivation is missing steps for generating a version file and for compiling protocol buffer sources, which would likely lead to build failures or incorrect application behavior. The suggested changes aim to fix these issues and ensure the build is both correct and hermetic.
| buildPhase = '' | ||
| runHook preBuild | ||
| export HOME="$NIX_BUILD_TOP" | ||
| ( cd "$NIX_BUILD_TOP" && tar xfz $deps ) | ||
| ${bazel}/bin/bazel --batch build \ | ||
| --nofetch \ | ||
| --repository_cache="$NIX_BUILD_TOP/output/cache" \ | ||
| --registry=file://${bazel-central-registry} \ | ||
| //java/dev/enola/cli:enola_deploy.jar | ||
| runHook postBuild | ||
| ''; |
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.
The buildPhase is missing two crucial steps from the original derivation that are still required:
- Version file generation: The command
echo -n "${gitRev}" > tools/version/VERSIONis missing. Without it, the application will lack correct version information at runtime. - Protobuf source generation: The
bash tools/protoc/protoc.bashcommand is missing. This step is necessary to generate Java source files from.protodefinitions before the build. Its absence will cause thebazel buildto fail due to missing sources.
Please reintroduce these steps into the buildPhase.
buildPhase = ''
runHook preBuild
# For dev.enola.common.Version to read version
echo -n "${gitRev}" > tools/version/VERSION
# Generate Java files from .proto
bash tools/protoc/protoc.bash
export HOME="$NIX_BUILD_TOP"
( cd "$NIX_BUILD_TOP" && tar xfz $deps )
${bazel}/bin/bazel --batch build \
--nofetch \
--repository_cache="$NIX_BUILD_TOP/output/cache" \
--registry=file://${bazel-central-registry} \
//java/dev/enola/cli:enola_deploy.jar
runHook postBuild
'';
| nativeBuildInputs = buildTools ++ [ | ||
| pkgs.makeWrapper | ||
| pkgs.which | ||
| jdk' | ||
| ]; |
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.
The nativeBuildInputs list contains redundant packages. The buildTools attribute already includes pkgs.which and jdk', so adding them again here is unnecessary. Removing these duplicates will improve the clarity and maintainability of the code.
nativeBuildInputs = buildTools ++ [
pkgs.makeWrapper
];
Relates to #1730.