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 mirror code & fix StartToMirror #18904

Merged
merged 10 commits into from
Mar 2, 2022
Merged

Conversation

Gusted
Copy link
Contributor

@Gusted Gusted commented Feb 25, 2022

  • Use the MirrorID as index(SQL uses id column not the repo_id, which currently seems to be expected). Passes the Mirror ID's into the Sync functions.
  • Fix StartToMirror to start Pull sync request for given repo.

I'm not actually sure if this fixes issues like #18860, but it's regardless a bug IMO as a repo could have multiple push mirrors.

- Use the MirrorID as index(SQL uses `id` column not the `repo_id`).
Passes the Mirror ID's into the Sync functions.
@Gusted Gusted added this to the 1.17.0 milestone Feb 25, 2022
@lunny lunny added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label Feb 26, 2022
@lunny
Copy link
Member

lunny commented Feb 26, 2022

I think this is right because one push mirror repository could have serval remote repositories. But this is potential break for those have tasks in the mirror queue.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 26, 2022
@Gusted
Copy link
Contributor Author

Gusted commented Feb 26, 2022

I think because of this PR the index should be changed to ID as it currently seems to be specified for repo_id?

services/mirror/mirror.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@bf2867d). Click here to learn what that means.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #18904   +/-   ##
=======================================
  Coverage        ?   46.66%           
=======================================
  Files           ?      854           
  Lines           ?   122576           
  Branches        ?        0           
=======================================
  Hits            ?    57199           
  Misses          ?    58485           
  Partials        ?     6892           
Impacted Files Coverage Δ
services/mirror/mirror.go 14.39% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf2867d...89b14e3. Read the comment docs.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 26, 2022
services/mirror/mirror.go Outdated Show resolved Hide resolved
@Gusted Gusted changed the title Use MirrorID instead of RepoID Refactor mirror code & fix StartToMirror Feb 28, 2022
@Gusted
Copy link
Contributor Author

Gusted commented Feb 28, 2022

Added a fix to StartToMirror(might need to rename it as well) as it was meant to add the given repoID to the pull mirror queue but somehow the code is getting all push mirrors and sync up those instead.

services/mirror/mirror.go Outdated Show resolved Hide resolved
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 1, 2022
@lunny
Copy link
Member

lunny commented Mar 2, 2022

make L-G-T-M work.

@lunny lunny merged commit a14b6f3 into go-gitea:main Mar 2, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 2, 2022
* giteaoffical/main:
  Refactor mirror code & fix `StartToMirror` (go-gitea#18904)
@Gusted Gusted deleted the fix-mirrors branch March 14, 2022 09:28
Gusted added a commit to Gusted/gitea that referenced this pull request Mar 14, 2022
lunny pushed a commit that referenced this pull request Mar 14, 2022
@lunny lunny added the backport/done All backports for this PR have been created label Mar 14, 2022
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* Use MirrorID instead of RepoID

- Use the MirrorID as index(SQL uses `id` column not the `repo_id`).
Passes the Mirror ID's into the Sync functions.

* Check for MirrorID == 0

* Fix `StartToMirror` + refactor

* Update services/mirror/mirror.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants