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

Draft: GitLab events / parsing refactoring #2590

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

mfocko
Copy link
Member

@mfocko mfocko commented Oct 21, 2024

TODO:

  • Write new tests or update the old ones to cover new functionality.
  • Update doc-strings where appropriate.
  • Update or write new documentation in packit/packit.dev.
  • ‹fill in›

Fixes

Supersedes #2586 (cause GitHub is a 🫓)

Merge before/after

RELEASE NOTES BEGIN

Packit now supports automatic ordering of ☕ after all checks pass.

RELEASE NOTES END

@mfocko mfocko self-assigned this Oct 21, 2024
@mfocko mfocko requested a review from a team as a code owner October 21, 2024 12:44
@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from feb7e0e to 9a8f285 Compare October 21, 2024 12:45
Copy link
Contributor

@mfocko
Copy link
Member Author

mfocko commented Oct 21, 2024

@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 as ‹original_name›, so that it breaks as least stuff as possible, but going forward it doesn't feel very feasible… it probably needs a better hierarchy 🤔

@mfocko
Copy link
Member Author

mfocko commented Oct 21, 2024

Tip

I had a feeling something will crawl out, when I make Event an abstract class

packit_service/worker/events/github/installation.py:41: error: Cannot instantiate abstract class "Installation" with abstract attributes "base_project" and "get_packages_config"  [abstract]

Copy link
Contributor

Copy link
Contributor

Copy link
Member

@lbarcziova lbarcziova left a 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

@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from 97853c1 to 1cd634b Compare October 25, 2024 12:42
Copy link
Contributor

@majamassarini
Copy link
Member

@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 as ‹original_name›, so that it breaks as least stuff as possible, but going forward it doesn't feel very feasible… it probably needs a better hierarchy 🤔

Thanks for starting this big refactoring, to me it looks good!
If I understand your concern, I think in future we should avoid import like this

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 🤔

@mfocko
Copy link
Member Author

mfocko commented Oct 28, 2024

Thanks for starting this big refactoring, to me it looks good! If I understand your concern, I think in future we should avoid import like this

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…

Copy link
Contributor

@mfocko mfocko linked an issue Nov 18, 2024 that may be closed by this pull request
8 tasks
@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from 7f6c114 to 3fa459b Compare November 25, 2024 12:51
Copy link
Contributor

@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from 3fa459b to f9e813c Compare November 25, 2024 13:06
Copy link
Contributor

@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from f9e813c to fee2a38 Compare November 26, 2024 15:53
Copy link
Contributor

@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from fee2a38 to e115f0c Compare December 3, 2024 14:07
Copy link
Contributor

@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from e115f0c to c0c227d Compare January 6, 2025 11:32
Copy link
Contributor

Copy link
Member

@lbarcziova lbarcziova left a 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!

@@ -463,12 +461,18 @@ def get_dict(self, default_dict: Optional[dict] = None) -> dict:

return d

# [XXX] Are these supposed to be abstract methods?
Copy link
Member

Choose a reason for hiding this comment

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

yes, I would say these should be abstract

"""
# [XXX] Is `True` as a default here a good idea?
Copy link
Member

Choose a reason for hiding this comment

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

I don't see that as an issue

self.account_id = account_id
self.account_url = account_url
self.account_type = account_type
# repos within the account/namespace
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# repos within the account/namespace
# repos within the account/namespace in the scope of the installation

Copy link
Member

Choose a reason for hiding this comment

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

looks to me a good candidate for breaking down as well, but can be done as a followup

Copy link
Contributor

mfocko added 15 commits January 15, 2025 13:44
remove after resolving

Signed-off-by: Matej Focko <[email protected]>
To be consistent with the naming from other modules.

Signed-off-by: Matej Focko <[email protected]>
@mfocko mfocko force-pushed the fix/gitlab-dg-events branch from 8e6af25 to 8346172 Compare January 15, 2025 12:44
Copy link
Contributor

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.

Prepare and refactor events/parsers for CentOS Stream dist-git comments
3 participants