gitlab remove project 失败

删除project失败,报500错误 “Whoops, something went wrong on our end.”

1. 查找日志

查找/var/log/gitlab/gitlab-rails/production.log ,对比执行过程,发现报错对应如下日志:
OpenSSL::Cipher::CipherError ():

官方推荐这个命令 gitlab-ctl tail gitlab-rails

Started GET "/-/metrics" for 127.0.0.1 at 2020-06-18 10:11:59 +0800
Processing by MetricsController#index as HTML
Completed 200 OK in 35ms (Views: 0.5ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
Started DELETE "/core/maxno" for 58.246.24.194 at 2020-06-18 10:12:03 +0800
Processing by ProjectsController#destroy as HTML
  Parameters: {"authenticity_token"=>"[FILTERED]", "namespace_id"=>"core", "id"=>"maxno"}
Completed 500 Internal Server Error in 24ms (ActiveRecord: 2.9ms | Elasticsearch: 0.0ms)
  
OpenSSL::Cipher::CipherError ():
  
lib/gitlab/crypto_helper.rb:27:in `aes256_gcm_decrypt'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:45:in `get_token'
app/models/concerns/token_authenticatable_strategies/base.rb:27:in `ensure_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:32:in `ensure_token'
app/models/concerns/token_authenticatable.rb:40:in `block in add_authentication_token_field'
app/services/projects/destroy_service.rb:13:in `async_execute'
lib/gitlab/metrics/instrumentation.rb:161:in `block in async_execute'
lib/gitlab/metrics/method_call.rb:36:in `measure'
lib/gitlab/metrics/instrumentation.rb:161:in `async_execute'
app/controllers/projects_controller.rb:149:in `destroy'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:28:in `set_current_ip_address'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:445:in `set_session_storage'
lib/gitlab/i18n.rb:55:in `with_locale'
lib/gitlab/i18n.rb:61:in `with_user_locale'
app/controllers/application_controller.rb:439:in `set_locale'
lib/gitlab/middleware/rails_queue_duration.rb:27:in `call'
lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
lib/gitlab/metrics/transaction.rb:57:in `run'
lib/gitlab/metrics/rack_middleware.rb:17:in `call'
lib/gitlab/middleware/multipart.rb:103:in `call'
lib/gitlab/request_profiler/middleware.rb:16:in `call'
ee/lib/gitlab/jira/middleware.rb:17:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:13:in `call'
lib/gitlab/middleware/correlation_id.rb:16:in `block in call'
lib/gitlab/middleware/correlation_id.rb:15:in `call'
lib/gitlab/middleware/read_only/controller.rb:42:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/request_context.rb:26:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:29:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'

2. google 解决办法。相信我,大部分的问题别人都碰到过。

https://gitlab.com/gitlab-org/gitlab-foss/-/issues/66002
https://gitlab.com/gitlab-org/gitlab-foss/-/issues/59413
https://docs.gitlab.com/ee/raketasks/backup_restore.html#when-the-secrets-file-is-lost

摘要:
just so I understand everything correctly, you had two machines, you export the projects from machine 1 and then imported it from machine 2 using the import/export feature right? I'm curious how you got the CI variables as CI variables are not exported.

OK, and was machine 2 set up with a fresh omnibus install? Or am backup? The reason I ask is we specify you need to reset everything that is encrypted A similar strategy can be employed for the remaining features - by removing the data that cannot be decrypted which in this case is the runner token.
Meaning you have to reset the tokens for runners. This can be done in two ways:

  • Rails console: Project.find_by_full_path('root/my-project').update(runners_token: nil, runners_token_encrypted:nil)
  • DB Console: UPDATE projects SET runners_token = null, runners_token_encrypted = null WHERE id = 28;

Note: The above is only done for 1 specific project you might have to do it for all projects. This will reset the registration token for the runners, all existing runners will keep working but new runners will have to use the new registration token.

进入DB控制台

[root@VM_1_17_centos ~]# gitlab-rails dbconsole
psql (10.7)
Type "help" for help.

gitlabhq_production=> 
Reset CI/CD variables

Check the ci_group_variables and ci_variables tables:
Those are the variables that you need to delete.

gitlabhq_production=> SELECT * FROM public."ci_group_variables";
 id | key | value | encrypted_value | encrypted_value_salt | encrypted_value_iv | group_id | protected | created_at | updated_at | masked | variable_type 
----+-----+-------+-----------------+----------------------+--------------------+----------+-----------+------------+------------+--------+---------------
(0 rows)

gitlabhq_production=> SELECT * FROM public."ci_variables";
 id | key | value | encrypted_value | encrypted_value_salt | encrypted_value_iv | project_id | protected | environment_scope | masked | variable_type 
----+-----+-------+-----------------+----------------------+--------------------+------------+-----------+-------------------+--------+---------------
(0 rows)
Reset Runner registration tokens

Clear all the tokens for projects, groups, and the whole instance:

gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
UPDATE 16
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
UPDATE 33
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;
UPDATE 1
gitlabhq_production=> UPDATE ci_runners SET token = null, token_encrypted = null;
UPDATE 0

3. 执行完后,都不用重启服务,立马见效

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,294评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,493评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,790评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,595评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,718评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,906评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,053评论 3 410
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,797评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,250评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,570评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,711评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,388评论 4 332
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,018评论 3 316
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,796评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,023评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,461评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,595评论 2 350