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

Use ProviderManager in webhook handler #3202

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented Apr 29, 2024

Relates to #2845

Switch to the use of the new ProviderManager interface in webhook handler to instantiate the Github provider.

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes #(related issue)

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@dmjb dmjb requested a review from a team as a code owner April 29, 2024 15:17
@@ -864,9 +846,8 @@ func getPullRequestInfoFromPayload(
}, nil
}

func reconcilePrWithDb(
func (s *Server) reconcilePrWithDb(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed some functions to methods so we do not need to pass around the db.Store pointer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long-term, we want these to be in the provider implementation and not the server, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, yes.

@@ -246,27 +243,6 @@ func (s *UnitTestSuite) TestHandleWebHookRepository() {
projectID := uuid.New()
providerID := uuid.New()

// create a test oauth2 token
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed because the token querying is not triggered unless the provider is actually instantiated. The test case for the handler does not need the provider to be instantiated.

@coveralls
Copy link

coveralls commented Apr 29, 2024

Coverage Status

coverage: 50.578% (-0.02%) from 50.594%
when pulling eaba89a on controlplane-provider-builder-cleanup
into 3b90c28 on main.

@dmjb dmjb changed the title Use ProviderBuilder in webhook handler Use ProviderManager in webhook handler Apr 30, 2024
@evankanderson evankanderson self-requested a review April 30, 2024 13:03
@puerco puerco self-requested a review April 30, 2024 13:03
action string,
) error {
// NOTE(jaosorior): this webhook is very specific to github
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is still true, we just think it's obvious, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - but this particular codepath is so Github-specific that it's not really worth noting any more.

@@ -864,9 +846,8 @@ func getPullRequestInfoFromPayload(
}, nil
}

func reconcilePrWithDb(
func (s *Server) reconcilePrWithDb(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long-term, we want these to be in the provider implementation and not the server, correct?

@dmjb dmjb merged commit 17799b4 into main Apr 30, 2024
22 checks passed
@dmjb dmjb deleted the controlplane-provider-builder-cleanup branch April 30, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants