Commit 7a88bf09782db5f6c2b22a0e16fbc9df1a2168eb
1 parent
fcfb6d84
Exists in
master
and in
4 other branches
Fix gitlab:check
Showing
2 changed files
with
1 additions
and
65 deletions
Show diff stats
config/gitlab.yml.example
| @@ -107,7 +107,7 @@ backup: | @@ -107,7 +107,7 @@ backup: | ||
| 107 | gitolite: | 107 | gitolite: |
| 108 | # REPOS_PATH MUST NOT BE A SYMLINK!!! | 108 | # REPOS_PATH MUST NOT BE A SYMLINK!!! |
| 109 | repos_path: /home/git/repositories/ | 109 | repos_path: /home/git/repositories/ |
| 110 | - hooks_path: /home/git/.gitolite/hooks/ | 110 | + hooks_path: /home/git/gitlab-shell/hooks/ |
| 111 | admin_key: gitlab | 111 | admin_key: gitlab |
| 112 | upload_pack: true | 112 | upload_pack: true |
| 113 | receive_pack: true | 113 | receive_pack: true |
lib/tasks/gitlab/check.rake
| @@ -377,10 +377,8 @@ namespace :gitlab do | @@ -377,10 +377,8 @@ namespace :gitlab do | ||
| 377 | check_repo_base_is_not_symlink | 377 | check_repo_base_is_not_symlink |
| 378 | check_repo_base_user_and_group | 378 | check_repo_base_user_and_group |
| 379 | check_repo_base_permissions | 379 | check_repo_base_permissions |
| 380 | - check_post_receive_hook_exists | ||
| 381 | check_post_receive_hook_is_up_to_date | 380 | check_post_receive_hook_is_up_to_date |
| 382 | check_repos_post_receive_hooks_is_link | 381 | check_repos_post_receive_hooks_is_link |
| 383 | - check_repos_git_config | ||
| 384 | 382 | ||
| 385 | finished_checking "Gitolite" | 383 | finished_checking "Gitolite" |
| 386 | end | 384 | end |
| @@ -389,29 +387,6 @@ namespace :gitlab do | @@ -389,29 +387,6 @@ namespace :gitlab do | ||
| 389 | # Checks | 387 | # Checks |
| 390 | ######################## | 388 | ######################## |
| 391 | 389 | ||
| 392 | - def check_post_receive_hook_exists | ||
| 393 | - print "post-receive hook exists? ... " | ||
| 394 | - | ||
| 395 | - hook_file = "post-receive" | ||
| 396 | - gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") | ||
| 397 | - gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) | ||
| 398 | - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user | ||
| 399 | - | ||
| 400 | - gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file) | ||
| 401 | - | ||
| 402 | - if File.exists?(gitolite_hook_file) | ||
| 403 | - puts "yes".green | ||
| 404 | - else | ||
| 405 | - puts "no".red | ||
| 406 | - try_fixing_it( | ||
| 407 | - "sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}" | ||
| 408 | - ) | ||
| 409 | - for_more_information( | ||
| 410 | - see_installation_guide_section "Setup GitLab Hooks" | ||
| 411 | - ) | ||
| 412 | - fix_and_rerun | ||
| 413 | - end | ||
| 414 | - end | ||
| 415 | 390 | ||
| 416 | def check_post_receive_hook_is_up_to_date | 391 | def check_post_receive_hook_is_up_to_date |
| 417 | print "post-receive hook up-to-date? ... " | 392 | print "post-receive hook up-to-date? ... " |
| @@ -537,45 +512,6 @@ namespace :gitlab do | @@ -537,45 +512,6 @@ namespace :gitlab do | ||
| 537 | end | 512 | end |
| 538 | end | 513 | end |
| 539 | 514 | ||
| 540 | - def check_repos_git_config | ||
| 541 | - print "Git config in repos: ... " | ||
| 542 | - | ||
| 543 | - unless Project.count > 0 | ||
| 544 | - puts "can't check, you have no projects".magenta | ||
| 545 | - return | ||
| 546 | - end | ||
| 547 | - puts "" | ||
| 548 | - | ||
| 549 | - options = { | ||
| 550 | - "core.sharedRepository" => "0660", | ||
| 551 | - } | ||
| 552 | - | ||
| 553 | - Project.find_each(batch_size: 100) do |project| | ||
| 554 | - print "#{project.name_with_namespace.yellow} ... " | ||
| 555 | - | ||
| 556 | - if project.empty_repo? | ||
| 557 | - puts "repository is empty".magenta | ||
| 558 | - else | ||
| 559 | - correct_options = options.map do |name, value| | ||
| 560 | - run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value | ||
| 561 | - end | ||
| 562 | - | ||
| 563 | - if correct_options.all? | ||
| 564 | - puts "ok".green | ||
| 565 | - else | ||
| 566 | - puts "wrong or missing".red | ||
| 567 | - try_fixing_it( | ||
| 568 | - sudo_gitlab("bundle exec rake gitlab:gitolite:update_repos RAILS_ENV=production") | ||
| 569 | - ) | ||
| 570 | - for_more_information( | ||
| 571 | - "doc/raketasks/maintenance.md" | ||
| 572 | - ) | ||
| 573 | - fix_and_rerun | ||
| 574 | - end | ||
| 575 | - end | ||
| 576 | - end | ||
| 577 | - end | ||
| 578 | - | ||
| 579 | def check_repos_post_receive_hooks_is_link | 515 | def check_repos_post_receive_hooks_is_link |
| 580 | print "post-receive hooks in repos are links: ... " | 516 | print "post-receive hooks in repos are links: ... " |
| 581 | 517 |