Pushing a specific repo fails -- ActionView::Template::Error --wrong argument type nil
Summary
GitLab errors 500 on editing a mirror-pushed repository's settings.
See reproduction on https://gitlab.com/matya/rudder-techniques/edit
Steps to reproduce
git clone --mirror https://github.com/Normation/rudder-techniques.git- Create new empty Repository on GitLab (I called it matya/rudder-techniques on gitlab.com)
git remote set-url --push origin https://matya@gitlab.com/matya/rudder-techniques.gitgit push --mirror
Expected behavior
- The repository's content should be shown in the GUI, and not "The repository for this project is empty"
- Editing the Repository should not throw an Error 500
Relevant logs and/or screenshots
In my production.log I find following error:
Started GET "/rudder/rudder-techniques/edit" for 127.0.0.1 at 2016-05-10 10:02:00 +0000
Processing by ProjectsController#edit as HTML
Parameters: {"namespace_id"=>"rudder", "id"=>"rudder-techniques"}
Completed 500 Internal Server Error in 205ms (ActiveRecord: 5.3ms)
ActionView::Template::Error (wrong argument type nil (expected String)):
2: %legend
3: Builds:
4:
5: - unless @repository.gitlab_ci_yml
6: .form-group
7: .col-sm-offset-2.col-sm-10
8: %p Builds need to be configured before you can begin using Continuous Integration.
app/models/repository.rb:83:in `commit'
app/models/repository.rb:496:in `head_commit'
app/models/repository.rb:500:in `head_tree'
app/models/repository.rb:506:in `tree'
app/models/repository.rb:486:in `gitlab_ci_yml'
app/views/projects/_builds_settings.html.haml:5:in `_app_views_projects__builds_settings_html_haml__3144337560220503174_26005440'
app/views/projects/edit.html.haml:87:in `block in _app_views_projects_edit_html_haml__4299395889018219917_162382060'
app/views/projects/edit.html.haml:8:in `_app_views_projects_edit_html_haml__4299395889018219917_162382060'
app/controllers/projects_controller.rb:24:in `edit'
lib/gitlab/middleware/go.rb:16:in `call'
Output of checks
Results of GitLab Application Check
# docker exec -ti gitlab-test bash
root@gitlab-test:/# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...
GitLab Shell version >= 2.7.2 ? ... OK (2.7.2)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by gitrepos:gitrepos? ... no
User id for gitrepos: 5686. Groupd id for gitrepos: group gitrepos doesn't exist
Try fixing it:
sudo chown -R gitrepos:gitrepos /var/opt/gitlab/git-data/repositories
For more information see:
doc/install/installation.md in section "GitLab Shell"
Please fix the error above and rerun the checks.
Repo base access is drwxrws---? ... yes
hooks directories in repos are links: ...
3/2 ... ok
4/3 ... ok
6/4 ... ok
7/5 ... ok
8/6 ... ok
3/7 ... ok
9/9 ... repository is empty
9/10 ... repository is empty
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/var/opt/gitlab/git-data/repositories: OK
/var/opt/gitlab/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.8.24
Send ping to redis server: PONG
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 ...
LDAP users with access to your GitLab server (only showing the first 100 results)
Server: ldapmain
<removed>
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ...
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? ... no
Try fixing it:
sudo chown -R gitrepos /var/opt/gitlab/gitlab-rails/uploads
sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
For more information see:
doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
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/2 ... yes
4/3 ... yes
6/4 ... yes
7/5 ... yes
8/6 ... yes
3/7 ... yes
9/9 ... yes
9/10 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.1.8)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 6
Checking GitLab ... Finished
root@gitlab-test:/#
Results of GitLab Environment Info
root@gitlab-test:/# gitlab-rake gitlab:env:info
System information
System: Ubuntu 14.04
Current User: gitrepo
Using RVM: no
Ruby Version: 2.1.8p440
Gem Version: 2.5.1
Bundler Version:1.10.6
Rake Version: 10.5.0
Sidekiq Version:4.0.1
GitLab information
Version: 8.7.3
Revision: 1d72f95
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://gitlab-test.fqdn.net
HTTP Clone URL: https://gitlab-test.fqdn.net/some-group/some-project.git
SSH Clone URL: gitrepos@gitlab-test.fqdn.net:some-group/some-project.git
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 2.7.2
Repositories: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
root@gitlab-test:/#
Edited by 🤖 GitLab Bot 🤖