尝试在GitLab中向我的项目添加Web Hook时,在提交表单以创建Web Hook后会出现500错误。
在gitlab.error.log文件中,我有以下错误:
ActionView::Template::Error (No route matches {:action=>"test", :controller=>"projects/hooks", :project_id=>#<Project id: 28, name: "Sandbox", path: "sandbox", description: "Project for playing with Gitlab", created_at: "2014-01-16 19:47:00", updated_at: "2014-01-16 19:47:00", creator_id: 1, issues_enabled: true, wall_enabled: false, merge_requests_enabled: true, wiki_enabled: true, namespace_id: 1, issues_tracker: "gitlab", issues_tracker_id: nil, snippets_enabled: false, last_activity_at: "2014-01-22 15:48:34", imported: false, import_url: "", visibility_level: 10, archived: false>, :id=>#<ProjectHook id: nil, url: "", project_id: 28, created_at: nil, updated_at: nil, type: "ProjectHook", service_id: nil, push_events: true, issues_events: false, merge_requests_events: false>, :format=>nil} missing required keys: [:id]):
52: - @hooks.each do |hook|
53: %li
54: .pull-right
55: = link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn btn-small grouped"
56: = link_to 'Remove', project_hook_path(@project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-small grouped"
57: .clearfix
58: %span.monospace= hook.url
app/views/projects/hooks/index.html.haml:55:in `block in _app_views_projects_hooks_index_html_haml__3155439581843495211_69974122950540'
app/views/projects/hooks/index.html.haml:52:in `_app_views_projects_hooks_index_html_haml__3155439581843495211_69974122950540'
app/controllers/projects/hooks_controller.rb:22:in `create'
app/controllers/application_controller.rb:57:in `set_current_user_for_thread'
这似乎意味着我的GitLab设置没有创建Web Hook或者没有返回id的错误。我对如何进一步调试此错误感到茫然。
答案 0 :(得分:2)
经过讨论,它看起来像是Gitlab核心中的一个错误。我建议你这样做:
找出你的钩子无效的原因。为此,您应该更改controller中@hook.save
上的@hook.save!
(如果挂钩无效,则会引发异常,您会在日志中看到错误)
也许这就足够了:你会看到一个错误,并将解决错误的原因
您需要修补本地APP以继续工作。有很多方法。我建议你最简单的方法 - 如果没有持久化挂钩(在DB中),不要呈现那部分视图
https://gist.github.com/gotva/8573700 - 第7行。请注意缩进haml
!
请将问题(错误)发布到官方回购邮箱。 Gitlab是一个很棒的项目 - 让我们帮助他们做得更好一点:)
PS(关于重新启动APP)是的,你是对的,它足以重启服务
PPS不会忘记在新版本的Gitlab发布时撤消本地更改