解决 Gitlab 中 the project is still being deleted 错误

Unless otherwise indicated, the text of documents in this site is available under the Creative Commons Attribution 3.0 Unported License, or any later version. Copyright 2009 - 2017 leopku.

团队使用 gitlab 8.16.6,部署在一个基于 Rancher 的 Docker 集群中。

最近发生了灵异事件:删除某个项目 Repo 之后,重建一个同名项目,系统会不让你建。无论是新建空项目还是 fork 项目。提示信息如下:

xxx Error

You tried to xxx {namespace} / {repo} but it failed for the following reason:

– The project is still being deleted. Please try again later.

通过日志,可以看到:

Started POST "/{namespace}/{repo}/forks?namespace_key=[FILTERED]" for {IP-ADDRESS} at 2017-01-30 13:26:41 +0100

Processing by Projects::ForksController#create as HTML

Parameters: {"authenticity_token"=>"{token}", "namespace_key"=>"[FILTERED]", "namespace_id"=>"{namespace}", "project_id"=>"{repo}"}

Unable to save project. Error: The project is still being deleted. Please try again later.

Error setting import status to failed: cannot update a new record. Original error: Unable to save project. Error: The project is still being deleted. Please try again later.

Completed 200 OK in 213ms (Views: 67.5ms | ActiveRecord: 21.6ms)

下面就暴力解决它:

p = Project.unscoped.find(123) // 123 为上面删除不掉的项目 id
p.pending_delete = false
p.save validate: false

懂 Ruby 和 Rails 的童鞋自然知道上面神马意思

想知道的也可以通过 Gitter 问我