Skip to content

Add `gitlab:db:validate_config` to ensure the proper `database_tasks:` is set

Kamil Trzciński requested to merge validate-database-tasks into master

What does this MR do and why?

Resolves part of: #356009 (closed).

This implements gitlab:db:validate_config to ensure correctness of used database_tasks::

  • A database configuration using database_tasks: true should not share this database with other jobs,
  • A database configuration using database_tasks: false should share the database with main:

This is done by doing a simple dependency rake task chained to db:migrate/db:schema:load/dump that:

  • Connects to each database configuration
  • Gets unique system identifier and current connected database
  • Performs a set of validation checks according to above criteria

The purpose of this check is to prevent running db:migrate/db:schema:load (and potentially loosing data) if the configuration is invalid. This rake task will raise an exception in such case.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kamil Trzciński

Merge request reports