-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: report cloudRunReadyEvent for Cloud Run worker pools
#9921
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
… as the cloudRunReadyEvent is not currently being reported.
Summary of ChangesHello @ChrisGe4, 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 enhances the event reporting mechanism for Cloud Run worker pools. Previously, 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 implements the reportSuccess method for Cloud Run worker pools to send a cloudRunReadyEvent. The implementation looks correct, but it's missing unit tests to verify the new behavior. Additionally, the new CloudRunWorkerPoolReady function in pkg/skaffold/event/v2/cloudrun.go introduces code duplication with the existing CloudRunServiceReady function. I've added comments with suggestions to address these points.
| func (r *runWorkerPoolResource) reportSuccess() { | ||
| eventV2.CloudRunWorkerPoolReady(r.path, r.latestRevision) | ||
| } |
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 change adds new behavior but lacks corresponding tests. The existing test suite, specifically TestPrintSummaryStatus in status_test.go, does not correctly test this code path for worker pools because it uses a runServiceResource mock instead of a runWorkerPoolResource.
Please add a unit test that:
- Uses a
runWorkerPoolResourcefor the test case. - Asserts that
eventV2.CloudRunWorkerPoolReadyis called with the correct parameters whenreportSuccessis invoked.
Without tests, we can't be sure this feature works as expected or protect it from future regressions.
| func CloudRunWorkerPoolReady(r, revision string) { | ||
| handler.handleCloudRunReady(&proto.CloudRunReadyEvent{ | ||
| Id: r, | ||
| TaskId: fmt.Sprintf("%s-%d", constants.Deploy, handler.iteration), | ||
| Resource: r, | ||
| ReadyRevision: revision, | ||
| }) | ||
| } |
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 function's implementation is very similar to CloudRunServiceReady, leading to code duplication. This can make maintenance harder. For example, if the TaskId format needs to be changed, it would have to be updated in multiple places.
To remove the duplication, you could reuse CloudRunServiceReady by passing an empty URL. This is a pragmatic way to solve the duplication within this PR. While calling a 'Service' function for a 'WorkerPool' is not ideal semantically, it avoids duplicating the event creation logic. A longer-term solution could be to introduce a more generic helper function.
func CloudRunWorkerPoolReady(r, revision string) {
CloudRunServiceReady(r, "", revision)
}
Description
The
func (r runWorkerPoolResource) reportSuccess()method needs to be implemented as thecloudRunReadyEventis not currently being reported.User facing changes (remove if N/A)
One more event will be logged. It will looks like
Follow-up Work (remove if N/A)