-
-
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
Add support for migrating from Gitlab #9084
Conversation
Still need to figure out how to hide tokens/etc from showing up in opts.CloneAddr
CloneAddr was being used as OriginalURL. Now passing OriginalURL through from the form and saving it.
Correct CloneURL. This should be functioning! Previous commits fixed "Migrated from" from including the migration credentials.
RepoID is grabbed in NewGitlabDownloader
Properly set milestone deadline time. Consistently use Gitlab username for 'Name'.
- Count of issues is kept to set a non-conflicting PR.ID - Bool is used to tell whether to fetch Issue or PR comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!! This will be so helpful for many users.
I haven't done a thorough review of this PR, but I found a few nits that would need to be resolved.
I think we have to add a selection on UI for self-hosted git services. |
For make the PR easier to merge I think maybe you could just support gitlab.com on this PR so that you could not change the UI and move self-host part for another PR. |
Ah yeah that makes sense. I'll get on that. |
Alright. Hopefully I did that right. Self-hosted support has been ripped out of this PR, and a new PR has been opened to re-add self-hosted support. |
The fix in eaf52a4 should go it its own small bugfix PR imo and should get back ported (where as this PR can't be) |
CloneAddr was being saved as OriginalURL. Now passing OriginalURL through from the form and saving it in it's place
@aqtrans since you Updated the branch I can send new patches to your branch ... thanks I'll look into why CI failes |
Status: just tested localy: It migrates: Labels, Milestones, Branches (git rev in generel), repo-topics and then It hangs in a loop |
make vendor with go1.14
Thanks a lot for the help! I've merged your latest PR and granted you access to my branch. |
Found the issues - not related to this pull: #11096 Will wait untill it is merged - after it I think this pull is ready :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@lunny nees your approval |
Ready to merge 🚀 |
ping lgtm |
It finaly went in 🎉 - thanks to all! |
Fantastic! Thanks a ton to y'all for all the help. |
* First stab at a Gitlab migrations interface. * Modify JS to show migration for Gitlab * Properly strip out #gitlab tag from repo name * Working Gitlab migrations! Still need to figure out how to hide tokens/etc from showing up in opts.CloneAddr * Try go-gitea#2 at trying to hide credentials. CloneAddr was being used as OriginalURL. Now passing OriginalURL through from the form and saving it. * Add go-gitlab dependency * Vendor go-gitlab * Use gitlab.BasicAuthClient Correct CloneURL. This should be functioning! Previous commits fixed "Migrated from" from including the migration credentials. * Replaced repoPath with repoID globally. RepoID is grabbed in NewGitlabDownloader * Logging touchup * Properly set private repo status. Properly set milestone deadline time. Consistently use Gitlab username for 'Name'. * Add go-gitlab vendor cache * Fix PR migrations: - Count of issues is kept to set a non-conflicting PR.ID - Bool is used to tell whether to fetch Issue or PR comments * Ensure merged PRs are closed and set with the proper time * Remove copyright and some commented code * Rip out '#gitlab' based self-hosted Gitlab support * Hide given credentials for migrated repos. CloneAddr was being saved as OriginalURL. Now passing OriginalURL through from the form and saving it in it's place * Use asset.URL directly, no point in parsing. Opened PRs should fall through to false. * Fix importing Milestones. Allow importing using Personal Tokens or anonymous access. * Fix Gitlab Milestone migration if DueDate isn't set * Empty Milestone due dates properly return nil, not zero time * Add GITLAB_READ_TOKEN to drone unit-test step * Add working gitlab_test.go. A Personal Access Token, given in env variable GITLAB_READ_TOKEN is required to run the test. * Fix linting issues * Add modified JS files * Remove pre-build JS files * Only merged PRs are marged as merged/closed * Test topics * Skip test if gitlab is inaccessible * Grab personal token from username, not password. Matches Github migration implementation * Add SetContext() to GitlabDownloader. * Checking Updated field in Issues. * Actually fetch Issue Updated time from Gitlab * Add Gitlab migration GetReviews() stub * Fix Patch and Clone URLs * check Updated too * fix mod * make vendor with go1.14 Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This adds a new migration interface to migrations from Gitlab, either self-hosted or hosted.
Another fix for all migrations is included, in eaf52a4.
While working on this, I noticed due to
OriginalURL
being set toCloneAddr
inCreateMigrateTask
that all migrated repos, Github as well, included the credentials in the database, as well as any "Migrated from" links in comments and such.I didn't want to change the UI, so the self-hosted Gitlab detection is based on a '#gitlab' URL fragment added to the end of the Clone Address. Not the best solution, but it does the trick for now and doesn't interfere with the migration process.
The Gitlab calls are all powered by github.com/xanzy/go-gitlab, which has been vendored.
All objects in the migrations API are supported.
There are some odd hacks related to comments and PRs, due to PRs and Issues sharing IDs in Gitea.