Migration failure of AddGitlabInstanceAdministrationProject when gitlab.yml is insufficient
Problem
It seems AddGitlabInstanceAdministrationProject
database migration fails (Added at https://gitlab.com/gitlab-org/gitlab-ee/commit/e543d5c28646f7b57792fabd6e01a455aac70570) because of the following error:
shinya@shinya-MS-7A34:~/workspace/thin-gdk/service/rails/src$ tre bin/rails db:migrate RAILS_ENV=development
== 20190801072937 AddGitlabInstanceAdministrationProject: migrating ===========
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `enable' for nil:NilClass
/home/shinya/workspace/thin-gdk/service/rails/src/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:178:in `prometheus_enabled?'
/home/shinya/workspace/thin-gdk/service/rails/src/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:129:in `add_to_whitelist'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:14:in `call'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:14:in `block in execute_steps'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:13:in `each'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:13:in `inject'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:13:in `execute_steps'
/home/shinya/workspace/thin-gdk/service/rails/src/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:34:in `execute!'
/home/shinya/workspace/thin-gdk/service/rails/src/db/post_migrate/20190801072937_add_gitlab_instance_administration_project.rb:7:in `up'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:817:in `exec_migration'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:797:in `block in migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:796:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:977:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/transactions.rb:212:in `transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1343:in `ddl_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1262:in `each'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1210:in `block in migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1210:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1036:in `up'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1011:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
bin/rails:4:in `<main>'
Caused by:
NoMethodError: undefined method `enable' for nil:NilClass
/home/shinya/workspace/thin-gdk/service/rails/src/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:178:in `prometheus_enabled?'
/home/shinya/workspace/thin-gdk/service/rails/src/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:129:in `add_to_whitelist'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:14:in `call'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:14:in `block in execute_steps'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:13:in `each'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:13:in `inject'
/home/shinya/workspace/thin-gdk/service/rails/src/app/models/concerns/stepable.rb:13:in `execute_steps'
/home/shinya/workspace/thin-gdk/service/rails/src/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:34:in `execute!'
/home/shinya/workspace/thin-gdk/service/rails/src/db/post_migrate/20190801072937_add_gitlab_instance_administration_project.rb:7:in `up'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:817:in `exec_migration'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:797:in `block in migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:796:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:977:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/transactions.rb:212:in `transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1343:in `ddl_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1262:in `each'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1210:in `block in migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1210:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1036:in `up'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/migration.rb:1011:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activerecord-5.2.3/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/shinya/workspace/thin-gdk/service/rails/cache/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I've already confirmed that modifying gitlab.yml to the following hash will resolve the problem:
prometheus:
enable: false
By default, the prometheus
entry doesn't have any contents (See gitlab.yml.example) so that it's considered as nil
when Gitlab.config.prometheus.enable
is evaluated, which causes the above error.
Proposal
-
nil
check on Gitlab.config.prometheus - Update gitlab.yml.example properly (also omnibus)