-
Notifications
You must be signed in to change notification settings - Fork 1
feat(tibuild): support single platform build #253
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
Conversation
Platform specification is not supported with the Jenkins engine and will be rejected during validation.
Key Changes:
Potential Problems:
Fixing Suggestions:
By addressing these issues, the pull request will be more consistent, error-free, and provide better user feedback. |
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.
Hello @wuhuizuo, 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!
Summary of Changes
This pull request introduces the ability to specify a target platform during the build process. This allows for building images for specific architectures like linux/amd64
, linux/arm64
, darwin/amd64
, or darwin/arm64
. The changes involve adding a Platform
field to the DevBuildSpec
struct, updating the cloud event creation to include the platform, and adding validation to prevent specifying a platform when using the Jenkins pipeline engine. Additionally, some field lengths were increased, and a more efficient way to check for the FIPS feature was implemented.
Highlights
- Platform Support: Adds support for specifying a target platform during the build process.
- Cloud Event Update: Updates the cloud event creation to include the specified platform as an extension.
- Validation: Adds validation to prevent specifying a platform when using the Jenkins pipeline engine.
- FIPS Feature Check: Replaces the loop-based FIPS feature check with
slices.Contains
for better efficiency.
Changelog
- tibuild/pkg/rest/service/cloud_event_client.go
- Adds the
paramPlatform
extension to the cloud event when thePlatform
field is set in theDevBuildSpec
.
- Adds the
- tibuild/pkg/rest/service/dev_build_service.go
- Imports the
slices
package. - Replaces the loop in
hasFIPS
function withslices.Contains
for checking the presence ofFIPS_FEATURE
. - Adds validation in
validateReq
to prevent specifying a platform when the pipeline engine is Jenkins.
- Imports the
- tibuild/pkg/rest/service/model.go
- Adds the
Platform
field to theDevBuildSpec
struct, allowing specification of the target platform. - Increases the field lengths of
BuildEnv
,ProductDockerfile
,ProductBaseImg
, andTargetImg
in theDevBuildSpec
struct.
- Adds the
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 is currently in preview and 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 to provide feedback.
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.
A platform's choice,
Builds target, finds its voice,
Code's path defined.
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
The pull request introduces support for building for a single platform, enhancing the flexibility of the tibuild tool. The changes look good overall, but there are a few areas that could be improved for clarity and maintainability.
Summary of Findings
- Error message clarity: The error message in
validateReq
function could be improved to provide more context about why a platform is not supported in the Jenkins engine. Consider including specific details or a link to documentation. - String concatenation: In
fillForFIPS
, consider usingfmt.Sprintf
for constructing thespec.BuildEnv
string to improve readability and maintainability. - GORM type varchar length: Consider the appropriate length for varchar fields in the
DevBuildSpec
struct to avoid potential data truncation issues. It's good that some of the varchar lengths were increased, but it's worth reviewing all of them.
Merge Readiness
The pull request is almost ready for merging. Addressing the comments regarding error message clarity and string concatenation would improve the code quality. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging. I recommend that the pull request not be merged until the high severity issues are addressed.
if spec.PipelineEngine == JenkinsEngine && spec.Platform != "" { | ||
return fmt.Errorf("platform %s is not supported in %s engine", spec.Platform, spec.PipelineEngine) | ||
} |
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 error message is good, but could be improved by providing more context or a link to documentation explaining why platforms are not supported in the Jenkins engine. This will help users understand the limitation and how to address it.
return fmt.Errorf("platform %s is not supported in %s engine. See [link to docs] for more information.", spec.Platform, spec.PipelineEngine)
@gemini-code-assist[bot]: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Key Changes:
Potential Problems:
Fixing Suggestions:
Overall, the changes look good, but these suggestions will help improve clarity and prevent potential issues. |
Summary of Key Changes:
Potential Problems Identified:
Suggestions for Fixes:
By addressing these issues and making the suggested improvements, the pull request should enhance the functionality and maintainability of the codebase. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wuhuizuo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
No description provided.