從 GitLab 13.8.x 升級到 14.2.x

因為有個 security 大洞,所以需要升級...

升級版本編號過程主要參考 https://docs.gitlab.com/ee/update/#upgrade-paths

$ sudo apt-get update
$ sudo apt-get install gitlab-ce=13.8.8-ce.0
$ sudo gitlab-ctl restart
$ sudo gitlab-ctl status
$ sudo apt-get install gitlab-ce=13.12.9-ce.0
$ sudo gitlab-ctl restart
$ sudo gitlab-ctl status
$ sudo apt-get install gitlab-ce=14.0.7-ce.0
$ sudo gitlab-ctl restart
$ sudo apt-get install gitlab-ce=14.1.4-ce.0
$ sudo gitlab-ctl restart
$ sudo apt-get install gitlab-ce=14.2.1-ce.0
$ sudo gitlab-rake db:migrate
$ sudo gitlab-ctl reconfigure
$ sudo gitlab-ctl restart
$ sudo apt-get install gitlab-ce=14.2.2-ce.0
$ sudo gitlab-ctl restart
$ sudo gitlab-ctl status

比較需要注意的是,根據 https://docs.gitlab.com/ee/update/#1420,到 14.2.x 的時候要做 db migrate。

然後有時會莫名其妙遇到從 14.1.x 升級到 14.2.x 的時候出錯 (也可能從 14.0.x 升級到 14.1.x 的時候有?),可以參考 https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#database-migrations-failing-because-of-batched-background-migration-not-finished,做以下處理。

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,push_event_payloads,event_id,'[["event_id"]\, ["event_id_convert_to_bigint"]]']

也會有可能遇到需要

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_stages,id,'[["id"]\, ["id_convert_to_bigint"]]']

ref:

  1. 從 GitLab 11.6.3 升級到 13.7.4
  2. https://www.v2ex.com/t/795606
  3. https://www.cnblogs.com/ybit/p/14918949.html
  4. https://nvd.nist.gov/vuln/detail/CVE-2021-22205