Private Bitbucket Server repo import failure
Summary
Importing a personal Bitbucket Server project into Gitlab results in a HTTP 422 error.
Steps to reproduce
- Create a personal Bitbucket Server repository as shown here: https://confluence.atlassian.com/bitbucketserver/creating-personal-repositories-776639832.html
- Attempt to import that project into Gitlab as shown here: https://docs.gitlab.com/ce/user/project/import/bitbucket_server.html
Example Project
N/A
What is the current bug behavior?
Import results in a HTTP 422 error in the Gitlab GUI.
What is the expected correct behavior?
Import would be successful.
Relevant logs and/or screenshots
When using Gitlab Omnibus, additional information is written to /var/log/gitlab/gitlab-rails/production.log
. IP and username info redacted.
Started POST "/import/bitbucket_server" for x.x.x.x at 2018-10-31 16:30:50 -0500
Processing by Import::BitbucketServerController#create as JSON
Parameters: {"repository"=>"bluejay", "project"=>"~USERNAME", "repo_id"=>"~USERNAME___bluejay", "target_namespace"=>"username", "new_name"=>"bluejay", "ci_cd_only"=>false, "bitbucket_server"=>{"repository"=>"bluejay", "project"=>"~USERNAME", "repo_id"=>"~USERNAME___bluejay", "target_namespace"=>"username", "new_name"=>"bluejay", "ci_cd_only"=>false}}
Filter chain halted as :validate_import_params rendered or redirected
Completed 422 Unprocessable Entity in 11ms (Views: 0.2ms | ActiveRecord: 1.8ms)
Output of checks
Happens on Gitlab CE.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: CentOS 7.4.1708 Current User: git Using RVM: no Ruby Version: 2.4.5p335 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown
GitLab information Version: 11.4.3 Revision: adea99b Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https:// HTTP Clone URL: https:///some-group/some-project.git SSH Clone URL: git@:some-group/some-project.git Using LDAP: yes Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 8.3.3 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...GitLab Shell version >= 8.3.3 ? ... OK (8.3.3) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/3 ... ok 2/8 ... ok 6/9 ... ok 5/10 ... ok 5/11 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/3 ... yes 2/8 ... yes 6/9 ... yes 5/10 ... yes 5/11 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.5) Git version >= 2.9.5 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 4
Checking GitLab ... Finished
Possible fixes
I suspect that the import failure stems from the tilde (~
) contained in the Bitbucket Server project and repo name. I assume this is against the naming conventions allowed in Gitlab, but considering this appears to be the default behavior for Bitbucket Server personal repositories I would expect the Bitbucket Server importer in Gitlab to gracefully handle this situation.
This issue appears to be related to the following issues, but not an exact duplicate.
Related: #45777 (moved) #2328 (moved)
/label ~bug ~import movingtogitlab