-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(tibuild): tibuild-v2 #249
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
The changes primarily focus on making field names consistent (using snake_case) and adjusting data types. This includes renaming git_hash to git_sha, changing pipeline_build_id from int64 to int, and updating various struct fields to follow a consistent naming pattern.
The above changes add the GitHub API client dependency and set up the initial infrastructure for interacting with GitHub repositories. It includes: 1. Adding github client to the service struct 2. Initial implementation of git SHA lookup 3. Splitting build creation logic into separate files 4. Adding status sync placeholder The key structural changes focused on better organizing the build service implementation while adding GitHub integration capability.
Skipping CI for Draft Pull Request. |
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 focuses on refactoring the tibuild
project, specifically version 2. The changes involve moving files and updating import paths to reflect a new directory structure. This includes updates to the README, command-line interface files, and main application files. The goal is to improve the project's organization and maintainability by introducing an internal
directory to encapsulate service implementation details and database-related code. It also introduces database integration using Ent, including schema creation and a store client for managing database connections, and updates the code generation process to use go generate
instead of goa
specific commands, simplifying the build process.
Highlights
- Directory Restructuring: The primary change is the reorganization of the project's directory structure, moving implementation details into an
internal
directory. - Import Path Updates: Import paths have been updated across multiple files to align with the new directory structure, ensuring that dependencies are correctly resolved.
- Database Integration: Introduces database integration using Ent, including schema creation and a store client for managing database connections.
- Code Generation: Updates the code generation process to use
go generate
instead ofgoa
specific commands, simplifying the build process.
Changelog
Click here to see the changelog
- experiments/tibuild-v2/README.md
- Updated the README to reflect the new location of
design/design.go
tointernal/service/design/design.go
and to usego generate
command.
- Updated the README to reflect the new location of
- experiments/tibuild-v2/cmd/tibuild-cli/http.go
- Updated import path for
cli
package togithub.com/PingCAP-QE/ee-apps/tibuild/internal/service/gen/http/cli/tibuild
.
- Updated import path for
- experiments/tibuild-v2/cmd/tibuild/http.go
- Updated import paths for
artifact
anddevbuild
server packages to reflect the newinternal/service
directory.
- Updated import paths for
- experiments/tibuild-v2/cmd/tibuild/init.go
- Added database initialization logic using Ent, including opening a connection and running schema migrations.
- Imported necessary packages for database interaction, including
context
,github.com/rs/zerolog/log
,github.com/PingCAP-QE/ee-apps/tibuild/internal/database/ent
, andgithub.com/go-sql-driver/mysql
.
- experiments/tibuild-v2/cmd/tibuild/main.go
- Updated import paths for
artifact
anddevbuild
packages to reflect the newinternal/service
directory. - Modified the main function to initialize a database client and pass it to the
devbuildSvc
.
- Updated import paths for
- experiments/tibuild-v2/gen/http/artifact/client/cli.go
- Removed the entire file, suggesting that this file is no longer needed or has been moved elsewhere.
- experiments/tibuild-v2/gen/http/cli/tibuild/cli.go
- Removed the entire file, suggesting that this file is no longer needed or has been moved elsewhere.
- experiments/tibuild-v2/gen/http/devbuild/client/cli.go
- Removed the entire file, suggesting that this file is no longer needed or has been moved elsewhere.
- experiments/tibuild-v2/gen/http/openapi.json
- Removed the entire file, suggesting that this file is no longer needed or has been moved elsewhere.
- experiments/tibuild-v2/gen/http/openapi.yaml
- Removed the entire file, suggesting that this file is no longer needed or has been moved elsewhere.
- experiments/tibuild-v2/go.mod
- Added new dependencies including entgo.io/ent, github.com/bndr/gojenkins, github.com/cloudevents/sdk-go/v2, github.com/go-sql-driver/mysql, github.com/google/go-containerregistry, github.com/google/go-github/v69, github.com/stretchr/testify, and others.
- Updated goa.design/clue version to v1.0.7.
- experiments/tibuild-v2/go.sum
- Updated the go.sum file to reflect the changes in dependencies.
- experiments/tibuild-v2/internal/database/ent/client.go
- Added a new file to manage the database client using Ent.
- experiments/tibuild-v2/internal/database/ent/devbuild.go
- Added a new file to manage the DevBuild entity using Ent.
- experiments/tibuild-v2/internal/database/ent/devbuild/devbuild.go
- Added a new file to manage the DevBuild entity's schema using Ent.
- experiments/tibuild-v2/internal/database/ent/devbuild/where.go
- Added a new file to manage the DevBuild entity's query predicates using Ent.
- experiments/tibuild-v2/internal/database/ent/devbuild_create.go
- Added a new file to manage the creation of DevBuild entities using Ent.
- experiments/tibuild-v2/internal/database/ent/devbuild_delete.go
- Added a new file to manage the deletion of DevBuild entities using Ent.
- experiments/tibuild-v2/internal/database/ent/ent.go
- Added a new file to manage the Ent schema.
- experiments/tibuild-v2/internal/database/ent/hook/hook.go
- Added a new file to manage Ent hooks.
- experiments/tibuild-v2/internal/database/ent/migrate/migrate.go
- Added a new file to manage Ent migrations.
- experiments/tibuild-v2/internal/database/ent/migrate/schema.go
- Added a new file to manage Ent schema definitions.
- experiments/tibuild-v2/internal/database/ent/tx.go
- Added a new file to manage Ent transactions.
- experiments/tibuild-v2/internal/service/design/design.go
- Changed package name from
design
toapi
. - Added HTTP configuration to include a prefix
/api/v2
to all API paths.
- Changed package name from
- experiments/tibuild-v2/internal/service/gen/http/openapi3.json
- Removed the entire file, suggesting that this file is no longer needed or has been moved elsewhere.
- experiments/tibuild-v2/internal/service/impl/artifact.go
- No changes to this file.
- experiments/tibuild-v2/internal/service/impl/devbuild.go
- No changes to this file.
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 refactor's task, a coder's plight,
To clean the code and make it bright.
With new paths laid,
And old ones swayed,
The project shines with newfound light.
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 refactors the tibuild application to use a new directory structure and leverages the ent framework for database interactions. The changes involve moving files, updating import paths, and modifying service implementations. Overall, the refactor seems well-structured, but there are a few areas that could benefit from further review and potential adjustments.
Summary of Findings
- Import Path Updates: Several files have undergone changes to their import paths due to the refactoring. It's crucial to verify that all import paths are correctly updated and that no dependencies are broken as a result.
- Database Schema Management: The introduction of ent for database schema management is a significant change. Ensure that the schema definitions are accurate and that the migration process is reliable and reversible.
- Service Implementation Changes: The service implementations have been modified to interact with the ent framework. It's important to thoroughly test these changes to ensure that the application's functionality remains intact and that data is handled correctly.
Merge Readiness
The pull request introduces significant changes to the project structure and database interactions. Due to the high and medium severity issues found, I recommend that the pull request not be merged until those are addressed. I am unable to directly approve this pull request, and other reviewers should also examine the code before merging.
@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. |
db981ba
to
26a88b1
Compare
Signed-off-by: wuhuizuo <[email protected]>
I Skip it since the diff size(1372609 bytes > 80000 bytes) is too large |
I Skip it since the diff size(1373628 bytes > 80000 bytes) is too large |
/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.