-
Notifications
You must be signed in to change notification settings - Fork 40
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
Use the new handlers when evaluating repo webhooks #4565
Use the new handlers when evaluating repo webhooks #4565
Conversation
mockPropsBld: newPropSvcMock( | ||
withSuccessRepoProto(), | ||
), | ||
mockRepoBld: newRepoSvcMock( |
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.
We can remove these two because we no longer call the repo service to refresh the repository and no longer call the property service. That's all done by the new handler.
}), | ||
), | ||
topic: events.TopicQueueEntityEvaluate, | ||
topic: events.TopicQueueRefreshEntityAndEvaluate, |
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.
we send a message to a new handler
@@ -1380,9 +1358,6 @@ func (s *UnitTestSuite) TestHandleGitHubWebHook() { | |||
require.Equal(t, "12345", received.Metadata["id"]) | |||
require.Equal(t, event, received.Metadata["type"]) | |||
require.Equal(t, "https://api.github.com/", received.Metadata["source"]) | |||
require.Equal(t, providerID.String(), received.Metadata["provider_id"]) | |||
require.Equal(t, projectID.String(), received.Metadata[entities.ProjectIDEventKey]) | |||
require.Equal(t, repositoryID.String(), received.Metadata["repository_id"]) |
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 message in the new handler doesn't have these metadata anymore, the job of the new handler is to figure these out
We added new watermill handlers that allow to refresh and evaluate a generic entity with properties. This is the first patch in a series that takes these handlers into account with the eventual goal of removing all the bespoke code from the GitHub webhook handler and eventually remove direct database access from the webhook handler. I'll expand the same method for the other webhook events we issue, but let's do small PRs so we can have some test runs in between them and revert in case of issues. Related: mindersec#4327
d6b57a0
to
52e6c77
Compare
Summary
We added new watermill handlers that allow to refresh and evaluate a
generic entity with properties. This is the first patch in a series that
takes these handlers into account with the eventual goal of removing all
the bespoke code from the GitHub webhook handler and eventually remove
direct database access from the webhook handler.
I'll expand the same method for the other webhook events we issue, but
let's do small PRs so we can have some test runs in between them and
revert in case of issues.
Related: #4327
Change Type
Testing
I ran a subset of smoke tests that target repos and made the unit tests pass.
Review Checklist: