-
Notifications
You must be signed in to change notification settings - Fork 12
feat(build): add flag to omit creation timestamp for reproducible builds #277
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
Signed-off-by: chlins <chlins.zhang@gmail.com>
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.
Summary of Changes
Hello @chlins, 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 a mechanism to achieve more reproducible builds by allowing users to omit the createdAt
timestamp from model configurations. This prevents variations in build artifacts solely due to the time of creation, ensuring consistent outputs across repeated build processes.
Highlights
- New CLI Flag for Build Reproducibility: A
--no-creation-time
boolean flag has been added to the build command-line interface, allowing users to prevent thecreatedAt
timestamp from being included in the model configuration. - Configuration Struct Updates: The
Build
struct inpkg/config/build.go
and theModel
struct inpkg/backend/build/config/model.go
have been updated to include aNoCreationTime
field, ensuring the flag's state is propagated through the build process. - Conditional Timestamp Generation: The model configuration builder in
pkg/backend/build/builder.go
now conditionally sets thecreatedAt
field based on theNoCreationTime
flag, ensuring that the timestamp is omitted when the flag is enabled.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 --no-creation-time
flag to support reproducible builds by omitting the createdAt
timestamp. The implementation is straightforward and correctly propagates the flag from the CLI to the model building logic. My review focuses on improving documentation, user-facing text, and ensuring test coverage for the new functionality. I've suggested adding doc comments for the new configuration fields, refining the CLI help message for clarity, and adding unit tests to validate the conditional timestamp logic.
// TODO: set the raw flag to true by default in future. | ||
flags.BoolVar(&buildConfig.Raw, "raw", false, "turning on this flag will build model artifact layers in raw format") | ||
flags.BoolVar(&buildConfig.Reasoning, "reasoning", false, "turning on this flag will mark this model as reasoning model in the config") | ||
flags.BoolVar(&buildConfig.NoCreationTime, "no-creation-time", false, "turning on this flag will not set createdAt in the config, which will be helpful for repeated builds") |
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 help text for this new flag is a bit verbose. For better CLI usability, consider making it more concise. A more idiomatic help message could be something like: Omit creation timestamp for reproducible builds
.
flags.BoolVar(&buildConfig.NoCreationTime, "no-creation-time", false, "turning on this flag will not set createdAt in the config, which will be helpful for repeated builds") | |
flags.BoolVar(&buildConfig.NoCreationTime, "no-creation-time", false, "Omit creation timestamp for reproducible builds") |
if !modelConfig.NoCreationTime { | ||
createdAt := time.Now() | ||
descriptor.CreatedAt = &createdAt | ||
} |
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.
This conditional logic is the core of the new feature. To ensure its correctness and prevent future regressions, it's important to add unit tests. Please consider updating TestBuildModelConfig
in pkg/backend/build/builder_test.go
to cover both scenarios: when NoCreationTime
is true
(asserting CreatedAt
is nil
) and when it's false
(asserting CreatedAt
is set).
SourceURL string | ||
SourceRevision string | ||
Reasoning bool | ||
NoCreationTime bool |
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.
Related issues: cc @bcfre |
This pull request introduces a new
--no-creation-time
flag to the build process, allowing users to optionally omit thecreatedAt
timestamp from the model configuration. This is particularly useful for achieving reproducible builds, as the timestamp would otherwise change with each build. The change is implemented by adding the flag to the CLI, propagating it through the configuration structs, and conditionally setting the creation time during model config generation.New Build Flag for Reproducibility:
--no-creation-time
boolean flag to the CLI incmd/build.go
, allowing users to skip setting thecreatedAt
field in the model config for repeated builds.Configuration and Propagation:
Build
struct inpkg/config/build.go
and theModel
struct inpkg/backend/build/config/model.go
to include aNoCreationTime
field, ensuring the flag is tracked through the build process. [1] [2]NewBuild
constructor to initializeNoCreationTime
tofalse
by default.NoCreationTime
value through the backend build logic to the model config builder inpkg/backend/build.go
.Conditional Creation Time Handling:
pkg/backend/build/builder.go
to only set thecreatedAt
field ifNoCreationTime
is not enabled, ensuring reproducibility when the flag is used.