Skip to content

Add namespace_ci_cd_settings table

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR adds a new namespace_ci_cd_settings table. This came from the need to have an indexed boolean setting assigned to namespaces which will determine which namespaces opted into stable CI runner pruning (this will be a cronjob to be introduced later on - see issue).

When tackling this, I looked at 2 options:

  1. Reusing namespace_settings by creating a field and an index there.
  • Advantage: Existing table, will play well when we need to extend the scope of this MVC to instance runners and project runners (with application_settings and project_settings/project_ci_cd_settings);
  • Disadvantages:
    • Lots of wasted space considering that a lot of namespaces will not have custom settings;
    • Could get unwieldy as time goes on if we continue to need to add runner-related settings;
  1. Creating a new namespace_ci_cd_settings table, similar to project_ci_cd_settings;
  • Advantages:
    • only namespaces that opt-in will have a row in this new table;
    • easier to add new runner-related settings in the future and keep them together;
  • Disadvantage:
    • We don't gain the existing hierarchy support from application_settings/namespace_settings/project_settings), although this seems to be encapsulated in a reusable module (CascadingNamespaceSettingAttribute);

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Migrations

Migrate up

== 20220503102855 AddNamespaceCiCdSettingsTable: migrating ====================
-- create_table(:namespace_ci_cd_settings, {})
   -> 0.0053s
== 20220503102855 AddNamespaceCiCdSettingsTable: migrated (0.0053s) ===========

Migrate down

== 20220503102855 AddNamespaceCiCdSettingsTable: reverting ====================
-- drop_table(:namespace_ci_cd_settings, {:if_exists=>true})
   -> 0.0021s
== 20220503102855 AddNamespaceCiCdSettingsTable: reverted (0.0021s) ===========

MR acceptance checklist

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

Part of Implement worker to remove stale runners from G... (#361112 - closed)

Merge request reports