-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Releases are deleted when mirror repository is synchronized #22066
Comments
Hm, maybe we should not allow to create release on a mirror repository? |
Why not keep them on sync? |
When setting up a migration from github and selecting the mirroring option, this disables the ability to sync labels, issues, pull requests, releases, milestones. Why would those be touched anyways during a sync when they're not configurable? I just setup a script to do the mirroring of releases and their assets on a whole bunch of repos only to find everything gone the next day. The attachments still exist in the attachments directory but are no longer associated with any release. |
Also interested in addressing this problem which arises when you use the new CI features in Gitea on a mirrored repository, with CI publishing local releases. |
Any pointers where to start fixing this in the code? |
My point is to prevent users to create releases on a mirror repository currently. |
Please don't prevent release creation on a mirror -- this is how we test/debug our CI processes. |
OK. Then you would like the second option. But how should Gitea handle when remote tags are deleted from your view point? |
Do you mean local tags? |
I mean as a mirror repository, if the source repository in the remote deleted some tags, when syncing the mirror repository, whether Gitea need to delete the release after the tags deleted? |
I would suggest to handle it the same as GitHub does. I think if you delete a tag for a release that release gets deleted or converted to draft (not 100% sure). Deleting the release in all cases is undesirable for me. In my mirror structure I want to manually (with the API) re-create the releases and mirror the binaries too. |
Not sure I care much about tags being deleted in the source repo since I'd never do that. I thought this problem was about this:
|
Yes, that's why I think we need to disable creating releases in a mirror repository. |
Ok, we're on same page then. For my purposes, I don't need tags associated with locally-created releases to be preserved in the mirror. |
In my case this forces me to use a non-mirror repository and manually mirror + recreate releases. My use case is hosting a mirror with release binaries in another region. The GitHub repository I mirror from is the main development place. Currently I’m forced to use a non-mirror already so it’s fine, but in general disabling releases altogether prevents my use case of a mirror completely… |
And again, I’m happy to try to contribute to the code. I just need some pointers where to start. |
Because #20311 will support mirror releases from upstream. So I think release creation on mirror repositories must be disabled. Otherwise, it will result in possible conflicts. |
I think there are two separate use cases for mirrored repositories:
Mine is the latter. In addition, I'm building my own signed releases from those mirrors. Because of this bug, I have to manually sync a fork instead of having automatic releases. Two proposals regarding #20311:
Not sure about the difficulty of those proposals, just throwing it out there. I really appreciate your hard work on Gitea! |
This is clearly a bug. |
Or maybe we can convert a release as draft automatically if the related tag has been removed when mirroring. |
I am not sure my issue is the same since most people seem to be talking about mirroring from github initially and/or creating the releases on the gitea side. My use case is a private gitea repo that mirrors to github. The commits sync fine to the remote github repo. I want to take advantage of the Actions on Github so I create the release there - manually for now. Everything works fine until I push another commit to my private gitea instance which then syncs to Github. At this point the releases disappear because they've been converted to drafts. Is this the same issue everyone is having? Is it happening because the gitea side does not have the tag I have to create on the github side? How should I proceed if I want to keep the same workflow? EDIT: I just tested this. If I create a tag on the gitea side first, it gets mirrored to github and the release does not get deleted. |
Any results? This bug has been around for a year now. I want to use Gitea to backup Github data, including binaries from releases, but this bug makes it impossible to backup releases at all. |
This bug was introduced by #19125. I think we need a method to not delete all previous releases but also keep better performance. The bottleneck is upset is very slow and the batch insert is not. |
Also, although the Release list is lost, the uploaded attachment files are not deleted. And every time you upload again, a copy of the attachment will be saved again, and no de-duplication will be done. This had caused me to store 500GB+ of invalid data on my disk. Is there any way I can delete this invalid data now? |
I'm not familiar with Gitea code. I've looked over the logic of this code and maybe changed this here to |
You can fix them with Yes, I think you are right. That's why I added this to 1.21.5. |
I sent #28817. It will not remove mirror releases when mirroring. |
Fix #22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of #19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory.
…a#28817) Fix go-gitea#22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of go-gitea#19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory.
…a#28817) Fix go-gitea#22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of go-gitea#19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory.
…#28939) Backport #28817 by @lunny Fix #22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of #19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
…a#28817) Fix go-gitea#22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of go-gitea#19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory.
Automatically locked because of our CONTRIBUTING guidelines |
Description
By some reason the created releases are deleted when mirror repository is synchronized even when the tags have not been recreated.
Steps
https://github.com/tailix/libkernaux
in the field "Migrate / Clone From URL"foobar
in the field "Title"Expected
You should see the label "Releases [1]" (the number as a badge) among the tabs.
Got
You see the label "Releases" (without a number) among the tabs.
Gitea Version
1.17.3 (self-hosted), 1.19.0+dev-166-g0a85537c7 (try.gitea.io)
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
2.37.2
Operating System
Ubuntu 22.10
How are you running Gitea?
https://try.gitea.io & self-hosted
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: