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

refactor: Move webhook event parsing logic to webhook handler #841

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Sep 4, 2023

This moves the event parsing logic to the webhook handler since that's
already github specific. Instead of doing any JSON mangling on the executor
side, it will expect already built events that are ready to be processed.

This makes the executor lighter and allows us to add more
complex logic on the webhook side (e.g. handling pull requests)

@JAORMX JAORMX changed the title refactor: Move webhook event parsinglogic to webhook handler WIP: refactor: Move webhook event parsinglogic to webhook handler Sep 4, 2023
@JAORMX JAORMX requested a review from jhrozek September 4, 2023 12:56
@jhrozek
Copy link
Contributor

jhrozek commented Sep 4, 2023

I replied on slack earlier but because not everyone can be up-to-date on slack conversations - I think this is a terrific refactor. We need to figure out a way to call the new eval handler on a slice of entities though to support init and reconcile handlers.

internal/engine/executor.go Outdated Show resolved Hide resolved
@JAORMX JAORMX force-pushed the event-refactor branch 4 times, most recently from ca9c0ac to 7dc079f Compare September 5, 2023 07:24
@JAORMX JAORMX changed the title WIP: refactor: Move webhook event parsinglogic to webhook handler WIP: refactor: Move webhook event parsing logic to webhook handler Sep 5, 2023
@JAORMX JAORMX force-pushed the event-refactor branch 2 times, most recently from 0f035ec to 7d07042 Compare September 5, 2023 08:35
@jhrozek
Copy link
Contributor

jhrozek commented Sep 5, 2023

In case anyone is following the PRs - we did a screen-share review with Ozz and I think this is a great refactor that should go in. Once the tests are added, I think this will be ready for merge and I'll rebase my pending PR with the policy init support for artifacts atop this one to keep the code clean.

This moves the event parsing logic to the webhook handler since that's
already github specific. Instead of doing any JSON mangling on the executor
side, it will expect already built events that are ready to be processed.

This makes the executor lighter and allows us to add more
complex logic on the webhook side (e.g. handling pull requests)
@JAORMX JAORMX requested a review from jhrozek September 5, 2023 10:55
@JAORMX JAORMX changed the title WIP: refactor: Move webhook event parsing logic to webhook handler refactor: Move webhook event parsing logic to webhook handler Sep 5, 2023
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

I also tested the patches by porting artifact init atop them and while there are small issues, I'm going to open a separate PR with the fixes (already done locally, rebased on this PR)

@JAORMX JAORMX merged commit 0801b3d into main Sep 5, 2023
12 checks passed
@JAORMX JAORMX deleted the event-refactor branch September 5, 2023 13:19
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.

2 participants