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

Bidirectional Mirroring e.g. GitLab Mirroring #2280

Open
1 of 7 tasks
lflare opened this issue Aug 8, 2017 · 31 comments
Open
1 of 7 tasks

Bidirectional Mirroring e.g. GitLab Mirroring #2280

lflare opened this issue Aug 8, 2017 · 31 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Comments

@lflare
Copy link
Contributor

lflare commented Aug 8, 2017

  • Gitea version (or commit ref): v1.1.3
  • Git version: N.A
  • Operating system: N.A
  • Database (use [x]): N.A
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Very simply, I understand that the current Gitea implementation has one-way remote mirroring, with the inability to modify the mirrored repository. However, I wish to propose a mirroring solution akin to that used in GitLab. Is this a feasible proposal? This feature is the only reason I have not switched fully to Gitea after all.

Screenshots

N.A

@lafriks
Copy link
Member

lafriks commented Aug 8, 2017

How would merge conflicts be resolved?

@lflare
Copy link
Contributor Author

lflare commented Aug 8, 2017

Like GitLab, it probably shouldn't perform merges. If a fast-forward is not possible, it simply shows the sync error messages. Additionally, if we can set a low sync time and have the repository both push and pull to the upstream mirror, the amount of conflicts would be much lower.

@lafriks lafriks added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Aug 8, 2017
@lafriks lafriks added this to the 1.x.x milestone Aug 8, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Aug 9, 2017

The only way to implement this correctly would be to pull on each push

@lflare
Copy link
Contributor Author

lflare commented Aug 9, 2017

@bkcsoft, I personally rather that the basic GitLab behaviour be included within the next release than having to wait for the hammering and debate for advanced Gitea-flavour behaviours to be included within the 2020 release.

I would personally be more than happy to work on Gitea again but there are a few reasons barring me from doing so.

@lflare
Copy link
Contributor Author

lflare commented Sep 25, 2017

I've thought about it for a bit and I think I have a strategy that may work. Essentially, Gitea pulls upstream repository every set interval or pre-push. After pulling, check if current push can be easily fast-forwarded, else reject and force user to pull first? What do you think @bkcsoft?

@lafriks
Copy link
Member

lafriks commented Sep 25, 2017

@lflare I think it would really slow down pushing to gitea if it would require pulling remote server

@daviian
Copy link
Member

daviian commented Sep 25, 2017

I think I miss the point of this feature. Can someone enlighten me and give use cases where this is useful / necessary?

@lflare
Copy link
Contributor Author

lflare commented Sep 25, 2017

@lafriks Maybe but also maybe not. Git when not transferring file content data, is relatively lightweight in that it compares checksums.

@daviian My case scenario is that I run Gitea with Github and I would really love to be able to push to my private Gitea and have it mirror the push to Github so I don't have to push twice and potentially forget to push.

@daviian
Copy link
Member

daviian commented Sep 25, 2017

@lflare But why do you prefer pushing to gitea instead of directly pushing to github? What advantages to you see in doing so?

@lafriks
Copy link
Member

lafriks commented Sep 25, 2017

If nobody is pushing to GitHub directly might be easier to set push git hook to push it further to github

@lflare
Copy link
Contributor Author

lflare commented Sep 25, 2017

@daviian I have people working on both the private Gitea instance and the Github instance and I personally prefer working on the private Gitea instance but also want the publicity of the repository being published on Github.

@lafriks That's when this feature request comes in, it's easily implementable with a couple of commands but it's incredibly inefficient if manual editing of the githooks are required every time I want to mirror a new repository.

@daviian
Copy link
Member

daviian commented Sep 25, 2017

@lflare How do you manage releases etc.? Do you create every release twice?

@lflare
Copy link
Contributor Author

lflare commented Sep 25, 2017

@daviian Currently, I don't create releases, I just tag versions. This is off-topic though.

@strk
Copy link
Member

strk commented Oct 21, 2017

What I do is have mirrors on github, with people only contributing via PR, then the PR is merged via commandline instead of via pushing the github button. A mirroring script, triggered by web hook, force-pushes into the github repo.

@pgaskin
Copy link
Contributor

pgaskin commented Oct 21, 2017

@strk I would also want something like this. I want to use Travis ci with some of my repos for testing on macOS, but it does not work with gitea, so I would want mirroring to GitHub from gitea

@bkcsoft
Copy link
Member

bkcsoft commented Oct 21, 2017

Essentially one of the sites has to be the authorative truth.
If that's GitHub pushing to Gitea would look like this:

  • On push pre-receive-pack (and pre-commit for gitea UI-updates) runs git pull --force and tells the user to rebase if it's changed (Promotes branching workflow). Pushes the new stuff to GitHub (before writing to the gitea-repo) and fails if that doesn't work.
  • On pull pre-upload-pack will git pull --force from GitHub into Gitea, then passes that back to the user.
  • On push to GiHub, GitHub needs to call a webhook /api/v1/:owner/:repo/mirror/update that does a git pull --force from GitHub.

For "Gitea is Authorative" the sequence would be

  • On push Gitea does git push --force after written to it's repo. On failure tell the user (don't error), and set a "broken mirror"-flag in the UI.
  • On pull Gitea does nothing to GitHub.

@strk
Copy link
Member

strk commented Oct 21, 2017 via email

@lflare
Copy link
Contributor Author

lflare commented Nov 26, 2017

Never mind, I've worked out a solution that I'm happy with in a patch on my fork. Thanks.

@lflare lflare closed this as completed Nov 26, 2017
@lafriks lafriks reopened this Nov 26, 2017
@lafriks
Copy link
Member

lafriks commented Nov 26, 2017

This can still be left open as feature request

@stale
Copy link

stale bot commented Feb 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 10, 2019
@lflare
Copy link
Contributor Author

lflare commented Feb 11, 2019

Not stale.

@stale stale bot removed the issue/stale label Feb 11, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Feb 11, 2019
@lflare
Copy link
Contributor Author

lflare commented Feb 24, 2019

@lunny What does that label mean?

@lafriks
Copy link
Member

lafriks commented Feb 24, 2019

@lflare just for stale bot not to close this for inactivity

@lunny lunny mentioned this issue Mar 1, 2019
7 tasks
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Mar 1, 2019
@ghost
Copy link

ghost commented Jun 9, 2019

You can't have bidirectional mirrors; you need something to mirror. There is one real object and one or more mirror images. That's just the way it is. There can only be one master.

@lflare
Copy link
Contributor Author

lflare commented Jun 10, 2019

@lifranc, I respectfully disagree. There's many applications for bidirectional mirroring for repositories. The wonders of Git allows for atomic commit histories and as long as there is a common base for repositories to be merged and mirrored, it can be done.

What is required, is a way for a user to configure merge strategies when a conflict is detected between two bidirectional mirrors, or perhaps a manual selector to choose how a conflict should be resolved. Apart from that, it should just behave like your traditional cloud file storage syncing mechanism.

@ghost
Copy link

ghost commented Jun 11, 2019

What is required, is a way for a user to configure merge strategies when a conflict is detected between two bidirectional mirrors, or perhaps a manual selector to choose how a conflict should be resolved. Apart from that, it should just behave like your traditional cloud file storage syncing mechanism.

That's not mirroring. Fine then you want to automate two-way merging. You could perhaps reason about it better if you considered this way. To me a mirror doesnt take actions; it only replicates a master, hence the confusion. I dont see any disagreement, just a different use of words.

PS. Those who are disgruntled by the fact that mirrors can only reflect already existing light are in for a tough life.

PPS. Matrix protocol does something like this to synchronize rooms across the federation. It's not trivial. Much easier to create a mirror of each repo on the other servers, and merge using those, that way there is no conflict blocking the flow of data, and automatic merging can still be used there.

@CodeDoctorDE
Copy link
Contributor

any updates?

@earl-warren
Copy link
Contributor

For the record https://gitea.com/earl-warren/gitea/pulls/2 is the first step to support the Friendly Forge Format (F3) which can eventually be used for bi-directional mirroring including issues, releases etc.

@Thaodan
Copy link

Thaodan commented Oct 16, 2022

For the record #6071 was closed because it was market about a duplicate (or is at least part of the issue). Simple git to git mirroring would be still possible either by overriding everything or synchronizing only specific ref/excluding to sync sync some.

@lunny lunny removed this from the 1.x.x milestone Mar 20, 2023
@HuJK
Copy link

HuJK commented Jan 3, 2024

any updates? We can accpet conflict occurs and resolve conflict manually, but we want this feature.
Not only mirroring, but syncing

@delvh
Copy link
Member

delvh commented Jan 3, 2024

  1. For this feature, there is one immediate dependency that needs to be implemented first: A merge conflict resolution UI. We cannot just allow inconsistent states to be merged.
  2. The best way to get a large feature is by creating a PR. Since Gitea is a community-based service, your only other option is to wait for someone else to implement it. Since there are currently >2400 issues open, good luck, might take a while until someone gets around to implement it for you.

6543 pushed a commit to 6543-forks/gitea that referenced this issue Feb 26, 2024
[I18n] Translations update from Weblate (go-gitea#2254)

Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: earl-work01 <contact+work01@earl-warren.org>
Co-authored-by: walpo <walpo@users.noreply.translate.codeberg.org>
Co-authored-by: Gusted <postmaster+codeberg@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2254
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>

Translations update from Weblate (go-gitea#2258)

Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Squeljur <squeljur+git@gmail.com>
Co-authored-by: oatbiscuits <oatbiscuits@proton.me>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: jadedctrl <jadedctrl@posteo.at>
Co-authored-by: earl-warren <contact@earl-warren.org>
Co-authored-by: 0que <0que@users.noreply.translate.codeberg.org>
Co-authored-by: noureddin <noureddin@protonmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2258
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>

[I18N] Translations update from Weblate (go-gitea#2274)

Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: 0que <0que@users.noreply.translate.codeberg.org>
Co-authored-by: oatbiscuits <oatbiscuits@proton.me>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2274
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>

[I18N] Translations update from Weblate (go-gitea#2280)

Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Current translation status:

![Weblate translation status](https://translate.codeberg.org/widget/forgejo/forgejo/horizontal-auto.svg)

Co-authored-by: earl-warren <contact@earl-warren.org>
Co-authored-by: micash <micash_545@protonmail.com>
Co-authored-by: 0que <0que@users.noreply.translate.codeberg.org>
Co-authored-by: oatbiscuits <oatbiscuits@proton.me>
Co-authored-by: jadedctrl <jadedctrl@posteo.at>
Co-authored-by: Werenter <abelokopytov149@gmail.com>
Co-authored-by: bizdelnick <mikhirev@gmail.com>
Co-authored-by: Xinayder <me+codeberg@aoalmeida.com>
Co-authored-by: noureddin <noureddin@protonmail.com>
Co-authored-by: nykula <nykula@ukr.net>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2280
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
(cherry picked from commit 9efeca55b1032d16284ad5e687440405cab775ef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

No branches or pull requests