Pages Domain Limits

What does this MR do and why?

Fixes: https://gitlab.com/gitlab-org/gitlab/-/issues/244293

Add ability to limit to the number of custom domains that can be associated with each GitLab Pages site. The default has been kept as 0 which corresponds to unlimited to make this change non-disruptive.

Screenshots or screen recordings

Configuring the limit

Screenshot_2022-08-26_at_5.07.57_PM

No longer able to add "New Domain" when limit is reached

image

**When you try to browse the "create-new-domain" URL directly

URL - <PROJECT_URL>/pages/domains/new

image

How to set up and validate locally

Follow the steps in the documentation(index.md) changes in this MR

Migrations

Up

main: == 20220818095225 AddMaxPagesCustomDomainsPerProject: migrating ===============
main: -- column_exists?(:application_settings, :max_pages_custom_domains_per_project)
main:    -> 0.4001s
main: -- add_column(:application_settings, :max_pages_custom_domains_per_project, :integer, {:null=>false, :default=>0})
main:    -> 0.0034s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- current_schema()
main:    -> 0.0007s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER TABLE application_settings\nADD CONSTRAINT app_settings_max_pages_custom_domains_per_project_check\nCHECK ( max_pages_custom_domains_per_project >= 0 )\nNOT VALID;\n")
main:    -> 0.0022s
main: -- current_schema()
main:    -> 0.0006s
main: -- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT app_settings_max_pages_custom_domains_per_project_check;")
main:    -> 0.0019s
main: == 20220818095225 AddMaxPagesCustomDomainsPerProject: migrated (0.4185s) ======

Down

main: == 20220818095225 AddMaxPagesCustomDomainsPerProject: reverting ===============
main: -- column_exists?(:application_settings, :max_pages_custom_domains_per_project)
main:    -> 0.4074s
main: -- remove_column(:application_settings, :max_pages_custom_domains_per_project)
main:    -> 0.0027s
main: == 20220818095225 AddMaxPagesCustomDomainsPerProject: reverted (0.4104s) ======

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 Vishal Tak

Merge request reports

Loading