gitlab-rake gitlab:import:repos create repo in wrong namespace
Summary
When using the rake task the repo is imported into the root namespace and not the specified user or group namespace.
Steps to reproduce
# # Setup # create user - testimport create repo - test-import-001 create file - file001.txt create branch - br-001 create tag - tag-001 create dir - mkdir -p /var/opt/gitlab/git-data/import-test/testimport set perms - chown -R git:git /var/opt/gitlab/git-data/import-test # # Copy to existing namespace # # 10.2.5 - behaviour # expected: repo to be imported into namespace # actual: imported into root namespace, existing repos moved to root namespace create repo to be imported # cp -rp /var/opt/gitlab/git-data/repositories/testimport/test-import-001.git /var/opt/gitlab/git-data/repositories/testimport/test-import-001-dup.git import repo # gitlab-rake --trace gitlab:import:repos['/var/opt/gitlab/git-data/repositories/testimport'] Processing /var/opt/gitlab/git-data/repositories/testimport/test-import-001-dup.git * Created test-import-001-dup (/test-import-001-dup) ### moved to root namespace * Skipping repo /var/opt/gitlab/git-data/repositories/testimport/test-import-001.wiki.git Processing /var/opt/gitlab/git-data/repositories/testimport/test-import-001.git * Created test-import-001 (/test-import-001) ### moved to root namespace # ls -l /var/opt/gitlab/git-data/repositories/testimport total 0 # 10.1.5 - behaviour # expected: repo to be imported into namespace # actual: repo imported into namespace create repo to be imported # cp -rp /var/opt/gitlab/git-data/repositories/testimport/test-import-001.git /var/opt/gitlab/git-data/repositories/testimport/test-import-001-dup.git import repo # gitlab-rake --trace gitlab:import:repos['/var/opt/gitlab/git-data/repositories/testimport'] Processing /var/opt/gitlab/git-data/repositories/testimport/test-import-001-dup.git * Namespace testimport exists. * Created test-import-001-dup (testimport/test-import-001-dup) ### not moved Processing /var/opt/gitlab/git-data/repositories/testimport/test-import-001.git * test-import-001 (testimport/test-import-001) exists * Skipping wiki repo # # Copy to temporary import directory # # # 10.2.5 # # ls -l /var/opt/gitlab/git-data/repositories/testimport total 8 drwxrwx--- 5 git git 4096 Dec 19 19:43 test-import-001.git drwxrwx--- 5 git git 4096 Dec 19 19:43 test-import-001.wiki.git # cp -rp /var/opt/gitlab/git-data/repositories/testimport/test-import-001.git /var/opt/gitlab/git-data/import-test/testimport/test-import-001-dup.git # ls -l /var/opt/gitlab/git-data/import-test/testimport/ drwxrwx--- 5 git git 4096 Dec 19 19:43 test-import-001-dup.git # gitlab-rake --trace gitlab:import:repos['/var/opt/gitlab/git-data/import-test'] Processing /var/opt/gitlab/git-data/import-test/testimport/test-import-001-dup.git * Using namespace: testimport * Created test-import-001-dup (testimport/test-import-001-dup) # says testimport namespace but imports into root # ls -l /var/opt/gitlab/git-data/import-test/testimport/ # repo is imported and moved # ls -l /var/opt/gitlab/git-data/repositories/testimport/ ### not here total 8 drwxrwx--- 5 git git 4096 Dec 19 19:43 test-import-001.git drwxrwx--- 5 git git 4096 Dec 19 19:43 test-import-001.wiki.git # ls -l /var/opt/gitlab/git-data/repositories/root ### created here drwxrwx--- 5 git git 4096 Dec 19 19:43 test-import-001-dup.git
What is the current bug behavior?
Repo is imported into root namespace and not the specified user or group namespace.
What is the expected correct behavior?
Repo is imported into specified namespace
Relevant logs and/or screenshots
see steps above
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.3.5p376 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.1.0 Redis Version: 3.2.5 Git Version: 2.13.6 Sidekiq Version:5.0.4 Go Version: unknown
GitLab information Version: 10.2.5-ee Revision: 3ec4b67 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.5 URL: https://astrachan-latest.asgks.net HTTP Clone URL: https://astrachan-latest.asgks.net/some-group/some-project.git SSH Clone URL: git@astrachan-latest.asgks.net:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: saml
GitLab Shell Version: 5.10.0 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 >= 5.10.0 ? ... OK (5.10.0) 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: ... ... 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 ...
LDAP is disabled in config/gitlab.yml
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: ... ...2/1 ... yes 3/2 ... yes 9/3 ... yes 6/4 ... yes 6/5 ... yes 3/6 ... yes 1/13 ... yes 6/25 ... yes 6/31 ... yes 6/32 ... yes 6/33 ... yes 1/46 ... yes 1/47 ... yes 1/48 ... yes 1/49 ... yes 1/50 ... yes 1/51 ... yes 6/54 ... yes 15/62 ... yes 1/63 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.5) Git version >= 2.7.3 ? ... yes (2.13.6) Git user has default SSH configuration? ... yes Active users: ... 7 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished