Skip to content

Reconcile ci_runner_taggings.name text limit with Ci::RunnerTagging.name text limit

The following discussion from !205053 (merged) should be addressed:

  • @bmarjanovic started a discussion: (+11 comments)

    question: in the model validation we have length: { maximum: 255 }, why is 512 here?

    Maybe it would be better to truncate the text coming from tag.name 💡

Implementation plan

  1. Check the longest tag names in the production database:

    SELECT LENGTH(tags.name) AS length, MAX(created_at) AS created_at, MAX(contacted_at) AS contacted_at,
      ARRAY_AGG(DISTINCT (ci_runner_taggings.runner_id)) AS runner_ids
    FROM ci _runner_taggings
      JOIN tags ON tags.id = ci_runner_taggings.tag_id
      JOIN ci_runners ON ci_runners.id = ci_runner_taggings.runner_id
    GROUP BY length
    ORDER BY length DESC
    LIMIT 5
  2. Before required stop, create batched background migration to trim tags that are longer than 255 characters (model already limits to this length on validation).

  3. After required stop, create migration to adjust text limit to 255 characters.

  4. Finalize batched background migration.