2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitLab14 => 15アップデート(docker-compose)

Posted at

GitLab15リリース!

5月22日にGitLabのバージョン15がリリースされました:tada::tada::tada:

アップデートしてみた

毎回GitLabのメジャーバージョンアップは何かしら起こるのですが、今回もすんなりとはいかなかったので備忘録として残しておきます

※v13からv14へのアップデートは以下を参照ください

※環境はdocker-composeで構築しています。詳細は以下の記事を参照ください

何も考えずにアップデートしてみる。v14.0.0 => v15.0.0

docker-compose downで既存コンテナを削除した後、docker-compose.ymlにて以下のようにイメージを変更してdocker-compose upでコンテナ作成してみました

  • gitlabコンテナ:15.0.0-ce.0
  • runnerコンテナ:alpine-v15.0.0

失敗しました。
最初に14.10.x系にアップグレードしてね。っていうメッセージが出てます。

 It seems you are upgrading from major version 14 to major version 15.
 It is required to upgrade to the latest 14.10.x version first before proceeding.
 Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrading-to-a-new-major-version

v13からv14の時も出た気がするので、これは想定内。

マイナーバージョンの最新化。v14.0.0 => v14.10.3

エラーが起きた

docker-compose.ymlにて以下のようにイメージを変更してdocker-compose upでコンテナ作成してみました

  • gitlabコンテナ:14.10.3-ce.0
  • runnerコンテナ:v14.10.1

以下のようなエラーが出ました

 ================================================================================
 Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
 ================================================================================

 ・・・

 ================================================================================
 Error executing action `run` on resource 'rails_migration[gitlab-rails]'
 ================================================================================

 ・・・
 rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource

原因調査

docker exec -it gitlab bashでdockerコンテナ内に入り、gitlab-rake db:migrate --traceを実行してログを確認したところ以下のエラーが出ていることが確認できました。

PG::UndefinedTable: ERROR:  relation "batched_background_migration_job_transition_logs" does not exist
LINE 8:  WHERE a.attrelid = '"batched_background_migration_job_trans...

対処

gitlab batched_background_migration_job_transition_logsで検索したところ以下を投稿を見つけたので、ここに記載されているコマンドを叩いてみました

gitlab-rake db:migrate:up VERSION=20211123135255
gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds,id,'[["id"\, "stage_id"]\, ["id_convert_to_bigint"\, "stage_id_convert_to_bigint"]]']

無事に14/10.3にアップグレードできました。

image.png

メジャーバージョンアップ。v14.10.3 => v15.0.0

改めてdocker-compose.ymlにて以下のようにイメージを変更してdocker-compose upでコンテナ作成してみました

  • gitlabコンテナ:15.0.0-ce.0
  • runnerコンテナ:alpine-v15.0.0 ※イメージ名の規則が今までと変わっているため注意(alpine-等のprefixが付いた)

これで、無事にアップグレードできました!

image.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?