问题描述
gitlab archive 500 error
在gitlab管理平台中对一个项目做归档操作,页面返回500错误,归档失败。
问题分析
我们在gitlab服务器终端开启一个会话,同步刷着日志,然后再次尝试,看看报什么错
[root@localhost ~]# gitlab-ctl tail
截取部分日志内容
==> /var/log/gitlab/puma/puma_stderr.log <==
==> /var/log/gitlab/puma/current <==
==> /var/log/gitlab/puma/state <==
==> /var/log/gitlab/gitlab-rails/production.log <==
.....
Completed 500 Internal Server Error in 86ms (ActiveRecord: 10.9ms | Elasticsearch: 0.0ms | Allocations: 17292)
......
OpenSSL::Cipher::CipherError ():
lib/gitlab/crypto_helper.rb:28:in `aes256_gcm_decrypt'
app/models/concerns/token_authenticatable_strategies/encryption_helper.rb:18:in `decrypt_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:45:in `get_token'
app/models/concerns/token_authenticatable_strategies/base.rb:32:in `ensure_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:32:in `ensure_token'
app/models/concerns/token_authenticatable.rb:43:in `block in add_authentication_token_field'
发现了问题:
与gitlab的encrypt(加密)和decrypt(解密)有关,GitLab对项目无法解密造成。
解决方法
运行如下命令
[root@localhost nginx]# gitlab-rails c
--------------------------------------------------------------------------------
Ruby: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
GitLab: 14.4.1 (1a23d731c9f) FOSS
GitLab Shell: 13.21.1
PostgreSQL: 12.7
--------------------------------------------------------------------------------
irb(main):001:0> Project.find_by_full_path('**/**/**/').update(runners_token: nil, runners_token_encrypted:nil)
=> true
注:括号中的是你的项目地址,至于是几级目录(不一定是这三级目录哦),请自行修改。
运行完成,返回true,再次进行归档操作,成功。
GitLab Issues 参考:https://gitlab.com/gitlab-org/gitlab/-/issues/35258