Cannot import bare git repos in subgroups using "gitlab-rake gitlab:import:repos"
Summary
It seems that "gitlab-rake gitlab:import:repos" was not updated to support subgroups.
Steps to reproduce
- Copy a bare git repository into a subgroup.
- Call "gitlab-rake gitlab:import:repos" (assuming omnibus installation here).
What is the current bug behavior?
It will:
- Try to create a group called "/" (e.g. mygroup/mysubgroup) and fail at it.
- Say that it created the git repository and even list the correct path but, in fact, it will copy/import it under "repositories/root/".
What is the expected correct behavior?
- Create the subgroup if needed.
- Import the git repo "in place".
Relevant logs and/or screenshots
Executing "gitlab-rake gitlab:import:repos" at the command line notably shows:
Processing MyGroup/MySubgroup/MyProjectToImport.git
* Failed trying to create group MyGroup/MySubgroup
* Created MyProjectToImport (MyGroup/MySubgroup/MyProjectToImport.git)
The /var/log/gitlab/gitlab-rails/application.log file contains:
April 06, 2017 10:41: Administrator created a new project "Administrator / MyProjectToImport"
The /var/log/gitlab/gitlab-shell/gitlab-shell.log file contains:
I, [2017-04-06T10:41:46.223618 #15281] INFO -- : Adding project root/MyProjectToImport.git at </home/gitlab/git-data/repositories/root/MyProjectToImport.git>.
I, [2017-04-06T10:41:46.498808 #15281] INFO -- : Moving existing hooks directory and symlinking global hooks directory for /home/gitlab/git-data/repositories/root/MyProjectToImport.git.
Results of GitLab environment info
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.7
Rake Version: 10.5.0
Redis Version: 3.2.5
Git Version: 2.10.2
Sidekiq Version:4.2.7
GitLab information
Version: 9.0.4
Revision: 63e052a
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://redacted.info
HTTP Clone URL: https://redacted.info/some-group/some-project.git
SSH Clone URL: git@redacted.info:some-group/some-project.git
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 5.0.0
Repository storage paths:
- default: /home/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 5.0.0 ? ... OK (5.0.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
17/1 ... ok
2/2 ... ok
2/3 ... repository is empty
8/5 ... ok
8/6 ... ok
8/7 ... ok
8/8 ... ok
8/9 ... ok
8/10 ... ok
8/11 ... ok
8/12 ... ok
8/13 ... ok
8/14 ... ok
8/15 ... ok
10/216 ... ok
10/217 ... ok
5/218 ... ok
2/219 ... ok
13/221 ... ok
13/222 ... ok
14/223 ... ok
14/225 ... ok
18/226 ... ok
20/227 ... ok
20/228 ... ok
20/229 ... ok
13/230 ... ok
26/231 ... ok
17/232 ... ok
15/233 ... ok
2/234 ... ok
2/235 ... ok
28/236 ... ok
29/237 ... ok
31/238 ... ok
2/239 ... ok
19/240 ... ok
14/241 ... ok
29/243 ... ok
36/244 ... ok
2/245 ... ok
34/246 ... ok
37/247 ... ok
34/248 ... ok
2/249 ... ok
20/251 ... ok
20/252 ... ok
39/253 ... ok
20/255 ... ok
20/256 ... ok
20/257 ... ok
13/258 ... ok
40/259 ... ok
2/260 ... ok
16/261 ... ok
34/262 ... ok
14/264 ... ok
29/266 ... ok
34/267 ... ok
40/268 ... ok
34/271 ... ok
20/272 ... ok
14/273 ... ok
2/274 ... ok
34/275 ... ok
40/277 ... ok
46/278 ... ok
46/279 ... ok
43/280 ... ok
46/281 ... ok
46/282 ... ok
46/283 ... ok
46/284 ... ok
46/285 ... repository is empty
46/286 ... ok
55/288 ... ok
55/289 ... ok
55/290 ... ok
55/291 ... ok
55/292 ... ok
59/293 ... ok
40/294 ... ok
62/295 ... ok
40/296 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
Server: OurLDAPserver
LDAP authentication... Anonymous. No `bind_dn` or `password` configured
LDAP users with access to your GitLab server (only showing the first 100 results)
<Redacted>
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... 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: ...
17/1 ... yes
2/2 ... yes
2/3 ... yes
8/5 ... yes
8/6 ... yes
8/7 ... yes
8/8 ... yes
8/9 ... yes
8/10 ... yes
8/11 ... yes
8/12 ... yes
8/13 ... yes
8/14 ... yes
8/15 ... yes
10/216 ... yes
10/217 ... yes
5/218 ... yes
2/219 ... yes
13/221 ... yes
13/222 ... yes
14/223 ... yes
14/225 ... yes
18/226 ... yes
20/227 ... yes
20/228 ... yes
20/229 ... yes
13/230 ... yes
26/231 ... yes
17/232 ... yes
15/233 ... yes
2/234 ... yes
2/235 ... yes
28/236 ... yes
29/237 ... yes
31/238 ... yes
2/239 ... yes
19/240 ... yes
14/241 ... yes
29/243 ... yes
36/244 ... yes
2/245 ... yes
34/246 ... yes
37/247 ... yes
34/248 ... yes
2/249 ... yes
20/251 ... yes
20/252 ... yes
39/253 ... yes
20/255 ... yes
20/256 ... yes
20/257 ... yes
13/258 ... yes
40/259 ... yes
2/260 ... yes
16/261 ... yes
34/262 ... yes
14/264 ... yes
29/266 ... yes
34/267 ... yes
40/268 ... yes
34/271 ... yes
20/272 ... yes
14/273 ... yes
2/274 ... yes
34/275 ... yes
40/277 ... yes
46/278 ... yes
46/279 ... yes
43/280 ... yes
46/281 ... yes
46/282 ... yes
46/283 ... yes
46/284 ... yes
46/285 ... yes
46/286 ... yes
55/288 ... yes
55/289 ... yes
55/290 ... yes
55/291 ... yes
55/292 ... yes
59/293 ... yes
40/294 ... yes
62/295 ... yes
40/296 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 38
Checking GitLab ... Finished
Possible fixes
It most likely involves updating lib/tasks/gitlab/import.rake
to support subgroups.