gtilab 迁移服务器后,发现 webhook 页面访问报 500,其他没有部署过webhook的项目是正常可以打开的
原因是因为旧的 webhook 与新的 webhook 存在兼容性问题
Completed 500 Internal Server Error in 26ms (ActiveRecord: 1.7ms | Elasticsearch: 0.0ms | Allocations: 12085)
ActionView::Template::Error ():
5: .row
6: .col-md-8.col-lg-7
7: %strong.light-header
8: = hook.url
9: - if hook.rate_limited?
10: = gl_badge_tag(_('Disabled'), variant: :danger, size: :sm)
11: - elsif hook.permanently_disabled?
app/views/shared/web_hooks/_hook.html.haml:8
app/views/shared/web_hooks/_index.html.haml:11
app/views/shared/web_hooks/_index.html.haml:10
解决方案:删除原来的 webhook,重新配置
切换用户
su - gitlab-psql
进入 gitlab 数据库
psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
查询项目 id
根据项目 id 查询 web_hooks 的 id
select id from web_hooks where project_id=7;
可看到 webhook 的 id 为 41 和 43,都删除
退出数据库
exit
申请令牌
或
执行api删除 webhook 41 和 43
curl --header "Private-Token: 4Yn1dffiTDpy5c2xvN8X" -X DELETE http://gitlab.com/api/v4/projects/7/hooks/41
curl --header "Private-Token: 4Yn1dffiTDpy5c2xvN8X" -X DELETE http://gitlab.com/api/v4/projects/7/hooks/43