Skip to content
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

feat(tibuild): support build with tekton engine for pull requests #138

Merged
merged 1 commit into from
May 6, 2024

Conversation

wuhuizuo
Copy link
Contributor

@wuhuizuo wuhuizuo commented May 6, 2024

Signed-off-by: wuhuizuo wuhuizuo@126.com

@ti-chi-bot ti-chi-bot bot requested a review from purelind May 6, 2024 09:40
Copy link

ti-chi-bot bot commented May 6, 2024

I have already done a preliminary review for you, and I hope to help you do a better job.

The pull request adds support for building with the Tekton engine for pull requests. It changes the implementation of the fillGitHash function to fillDetailInfoForTekton, which now fills in more information for Tekton builds, such as the pull request number and the base Git reference.

The code changes look good and the tests pass. However, there are a few suggestions to improve the code:

  • It might be better to move the newFakeGitHubPushEventPayload and newFakeGitHubPullRequestPayload functions to a separate package since they are not used in this file.
  • It is good practice to add more test cases to verify that the new changes work correctly.
  • The convertParamGitRefToGitHubRef function is not tested, and it might be helpful to add some test cases to ensure that it works correctly.

Overall, the changes look good, and the code is well-organized and easy to read.

@ti-chi-bot ti-chi-bot bot added the size/L label May 6, 2024
Signed-off-by: wuhuizuo <wuhuizuo@126.com>
Copy link

ti-chi-bot bot commented May 6, 2024

I have already done a preliminary review for you, and I hope to help you do a better job.

The pull request titled "feat(tibuild): support build with tekton engine for pull requests" introduces a feature for supporting the build process with the Tekton engine for pull requests. Here are the key changes:

  1. Two new constants for event types (ceTypeFakeGHPushDevBuild and ceTypeFakeGHPRDevBuild) have been added.

  2. The TriggerDevBuild method in CloudEventClient struct now uses the newDevBuildCloudEvent method to create a new Dev Build Cloud Event.

  3. The NewDevBuildCloudEvent has been renamed to newDevBuildCloudEvent. This method now handles two different types of git references - branches and pull requests - and creates a different event type based on the git reference type.

  4. Two new methods have been added: newFakeGitHubPushEventPayload and newFakeGitHubPullRequestPayload which create payloads for GitHub push and pull request events respectively.

  5. The fillGitHash method in dev_build_service.go is renamed to fillDetailInfoForTekton and now also handles pull requests, fetching additional information like PR number, base ref, and git hash.

  6. The GetHash method in gh_client.go is updated to handle different types of git references.

  7. The GHClient interface is extended with a new method GetPullRequestInfo.

  8. The DevBuildSpec struct is updated with additional fields.

Potential Problems:

  1. The code lacks sufficient comments, which might make it difficult for other developers to understand the context and functionality.

  2. Error handling and logging seem to be missing in some places. For example, in the TriggerDevBuild method, it would be helpful to log the error message that might occur while creating a new Dev Build Cloud Event.

  3. There are no tests for the new methods introduced like newFakeGitHubPushEventPayload and newFakeGitHubPullRequestPayload. This might lead to uncaught bugs and issues.

Fixing Suggestions:

  1. Add comments to the methods to explain their functionality.

  2. Improve error handling and add logging where necessary.

  3. Write unit tests for the newly introduced methods to ensure they work as expected.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented May 6, 2024

/approve

Copy link

ti-chi-bot bot commented May 6, 2024

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label May 6, 2024
@ti-chi-bot ti-chi-bot bot merged commit 6592f5d into main May 6, 2024
3 checks passed
@ti-chi-bot ti-chi-bot bot deleted the feature/tibuild-pr-build branch May 6, 2024 12:11
wuhuizuo added a commit to PingCAP-QE/ee-ops that referenced this pull request May 6, 2024
ref: PingCAP-QE/ee-apps#138
Signed-off-by: wuhuizuo <wuhuizuo@126.com>
ti-chi-bot bot pushed a commit to PingCAP-QE/ee-ops that referenced this pull request May 6, 2024
ref: PingCAP-QE/ee-apps#138
Signed-off-by: wuhuizuo <wuhuizuo@126.com>

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant