-
Notifications
You must be signed in to change notification settings - Fork 49
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
GitLab events / parsing refactoring #2590
GitLab events / parsing refactoring #2590
Conversation
feb7e0e
to
9a8f285
Compare
Build failed. ✔️ pre-commit SUCCESS in 2m 16s |
@majamassarini @lbarcziova WDYT? At the moment it's broken everywhere possible :D it looks like we have also some pretty intrusive mocking in place, so this reshuffle opened the can of worms… I still haven't made up my mind about the usage of the events, cause they can be imported as from packit_service.worker.events.github.pr import Synchronize but at the same time I have a feeling that it won't look very good once it gets mixed up with the other forges, for now I replaced the imports with |
Tip I had a feeling something will crawl out, when I make
|
Build failed. ✔️ pre-commit SUCCESS in 2m 19s |
Build failed. ✔️ pre-commit SUCCESS in 2m 15s |
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 structure looks good to me 🚀
for now I replaced the imports with as ‹original_name›, so that it breaks as least stuff as possible, but going forward it doesn't feel very feasible
agreed it may be a good middle step
97853c1
to
1cd634b
Compare
Build failed. ✔️ pre-commit SUCCESS in 2m 12s |
Thanks for starting this big refactoring, to me it looks good! from packit_service.worker.events.github.pr import Synchronize and use instead the namespaces we have created from packit_service.worker.events import github, gitlab, pagure
[...]
github.pr.Synchronize
[...]
gitlab.pr.Synchronize So I think the hierarchy is fine 🤔 |
oh i see, so you really wanna use it like that 😁 I was a bit worried how explicit it will be, but I guess it's better edit: BTW I managed to break the mypy locally, it crashes :D but passes in Zuul… |
Build failed. ✔️ pre-commit SUCCESS in 2m 05s |
7f6c114
to
3fa459b
Compare
Build failed. ✔️ pre-commit SUCCESS in 2m 03s |
3fa459b
to
f9e813c
Compare
Build failed. ✔️ pre-commit SUCCESS in 2m 03s |
f9e813c
to
fee2a38
Compare
Build failed. ✔️ pre-commit SUCCESS in 2m 10s |
fee2a38
to
e115f0c
Compare
Build failed. ✔️ pre-commit SUCCESS in 2m 08s |
e115f0c
to
c0c227d
Compare
Build failed. ✔️ pre-commit SUCCESS in 1m 47s |
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.
I really like how you broke this up into smaller pieces, this is so much more readable, good job!
Build failed. ✔️ pre-commit SUCCESS in 1m 45s |
8e6af25
to
8346172
Compare
Build failed. ✔️ pre-commit SUCCESS in 1m 50s |
Signed-off-by: Matej Focko <mfocko@redhat.com>
Add empty lines in between license and the imports to have a consistent style. Signed-off-by: Matej Focko <mfocko@redhat.com>
To be consistent with the naming from other modules. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Till now we have used ‹.__name__› on the event classes for serialization for the Celery, but after the refactor the ‹.__name__› contains just the last name in the whole path (i.e., only the class name is included, modules are lost) which creates conflicts and also breaks the matching of serialized ‹event_type› to the respective classes. Therefore implement a new abstract class method that returns the whole event type (including the source and any additional subtyping). Also implement the ‹event_type()› for some of the abstract classes that are used in the tests, with a check that the tests are running to ensure that abstract classes are not constructed during the runtime. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
When running the tests ‹__class__› resolves to the mock class which doesn't have correct value, therefore use ‹.event_type()› on the object itself. Signed-off-by: Matej Focko <mfocko@redhat.com>
Sign up for the pain and suffering since I refactored it. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
As discussed in the PR introducing this refactor, switch from not very descriptive ‹push.Push› to ‹push.Commit› and in case of GitLab events also ‹push.TagPush› to ‹push.Tag›. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
620fce8
to
6c6fe8e
Compare
Build succeeded. ✔️ pre-commit SUCCESS in 1m 48s |
Suggested-by: Laura Barcziová <lbarczio@redhat.com> Signed-off-by: Matej Focko <mfocko@redhat.com>
Build succeeded. ✔️ pre-commit SUCCESS in 1m 53s |
Co-authored-by: Laura Barcziová <lbarczio@redhat.com> Signed-off-by: Matej Focko <mfocko@redhat.com>
Build succeeded. ✔️ pre-commit SUCCESS in 1m 49s |
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 1m 48s |
bcaa612
into
packit:main
TODO
.event_type()
for those with an assertion to check that the tests are actually running…Comments / questions from the commits
db_project_object
,db_project_event
andproject
(currently unimplemented method in superclasses, property that caches to an attribute)Comment from the review:
project_object
andproject_event
are constructed at the same time via one helper function, therefore the caching can't be simply wrapped with acached_property
Event.pre_check
returnsTrue
by default…False
Reconsider structuring
forge.push.Push
(respectivelygitlab.push.TagPush
) →forge.push.Commit
orforge.push.Tag
anitya.base
→anitya.events
(not used directly though, events are exposed via__init__.py
as it doesn't make much sense to structure them further)forge.pr.Synchronize
doesn't make sense, it is “some kind of an action” on the PR/MR, but Synchronize has been inspired by the GitHub itself (and it's an example of an action on the PR), but I don't have a better name… maybe evenforge.pr.Change
/forge.pr.Action
?events.enums
for PR/MRs, comments and FedMsg…Combination of both… as for the PR and comment actions they are shared by GitHub and Pagure, therefore I kept those shared actions in the
events.enums
, while moving the GitLab enum that's also shared by GitLab-only events toevents.gitlab.enums
and as for the OpenScanHub, the least disruptive change (since the enum is tied only to the task) toevents.openscanhub.task.Status
Follow OpenScanHub implementation by Maja: nests the enumerations into the event type itself, which is a possible way, but it looks a bit weird used in code
Have a separate module (e.g.
openscanhub.enum
) for all of them consistentlyGoing from the current change:
I'd probably prefer
openscanhub.task.Status.success
👀Fixes
Supersedes #2586 (cause GitHub is a 🫓)
Merge before/after