Skip to content

Increase the string limits for regex fields in push_rules

Vasilii Iakliushin requested to merge 423445_increase_push_rules_limits into master

What does this MR do and why?

Contributes to #423445 (closed)

Problem

We have a discrepancy between GitLab database and db/structure.sql. GitLab database contains 255 character limit for regex fields. But this limit is missing for self-hosted instances and GDK.

Solution

Recently we added a Rails validation to prevent regex longer than 511 characters (!128153 (merged)).

We can migrate existing columns to match this limit.

Potential problems

  1. The migration can fail on self-hosted instances that have push rules regex longer than 511 characters in database.
  • It should be mitigated by Rails validations: !128153 (merged).
  • It also rare for users to use such long regexes. The longest one of self-hosted customers used was around 440 characters.

Are there safer ways to migrate this data?

  1. I also migrated branch_name_regex and commit_message_negative_regex that don't have a limit in the production database. But they should follow the same limitation logic as other regex fields.

However, we can migrate them separately if it raises any concerns.

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 Vasilii Iakliushin

Merge request reports