-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Implement sync push mirror on commit #19411
Conversation
Since services/mirror is not too big, Is it necessary to split it as two packages? |
In services/mirror, functions dealing with pull mirrors would send new notifications. Then services/mirror imports modules/notification, which then imports modules/notification/mirror, which then must call functions in services/mirror again. It causes a circular imports. To avoid it, push mirror related functions must be in a new package, so that:
|
To avoid import cycle, we can move some into |
What exactly differentiates packages in Sorry that I'm new to gitea contributions. Any more suggestions would be much appreciated. |
I still think push mirror and pull mirror have to be separated. That will allow the event pipelines to flow from pull sync to push sync, through notifications. graph LR;
A["pull sync"] --> C["new commits"];
B["git push"] --> C;
C --> D["push sync"];
Separation of two mirror types would be the most natural fit for this event flow. Again, any other ideas welcomed. |
Now it's using a |
The functions related push mirrors will be called by notification module, when sync-on-push is supported. So relevant functions are moved to pushmirror service package to avoid circular imports.
Some functions in services/mirror are moved to modules/mirror package. This approach solves the circular imports problem without introducting a seperate pushmirror package.
Codecov Report
@@ Coverage Diff @@
## main #19411 +/- ##
=======================================
Coverage ? 46.91%
=======================================
Files ? 975
Lines ? 134972
Branches ? 0
=======================================
Hits ? 63320
Misses ? 63893
Partials ? 7759
Continue to review full report at Codecov.
|
Co-authored-by: delvh <dev.lh@web.de>
Assuming this is not backported to v1.17 - once we merge this we will not be able to merge any more migrations - including fixups. Are we certain that all of our 1.17 migrations are correct? |
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
make lgtm work |
* giteaoffical/main: Implement sync push mirror on commit (go-gitea#19411) Use git.HOME_PATH for Git HOME directory (go-gitea#20114)
Support synchronizing with the push mirrors whenever new commits are pushed or synced from pull mirror. Related Issues: go-gitea#18220 Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Support synchronizing with the push mirrors whenever new commits are pushed or synced from pull mirror. Related Issues: go-gitea#18220 Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Support synchronizing with the push mirrors whenever new commits are pushed or synced from pull mirror. Related Issues: go-gitea#18220 Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
I'm currently testing this feature using |
@Arsen6331 please open a new issue for this, as otherwise things get lost in closed threads. |
Support synchronizing with the push mirrors whenever new commits are pushed or synced from pull mirror.
Related Issues: #18220
Breaking changes:
SyncOnCommit
is added toPushMirror
struct, thus a database migration is necessary.TODO:
Screenshot: (the checkbox "Sync when new commit is pushed")