Add pipeline metadata name truncation

What does this MR do and why?

Updates the pipeline metadata handling to ensure pipeline names are truncated to the maximum allowed length before being assigned to pipeline metadata.

This also adds the corresponding NAME_MAX_LENGTH constant and validation, along with test coverage for names that exceed the maximum length, including names that become too long after CI variable expansion.

References

Related to #632045 (closed)

Screenshots or screen recordings

Not applicable.

How to set up and validate locally

  1. Run the relevant RSpec test:

bundle exec rspec spec/lib/gitlab/ci/pipeline/chain/populate_metadata_spec.rb

  1. Run RuboCop against the changed Ruby files:

bundle exec rubocop \ app/models/ci/pipeline_metadata.rb \ lib/gitlab/ci/pipeline/chain/populate_metadata.rb \ spec/lib/gitlab/ci/pipeline/chain/populate_metadata_spec.rb

MR acceptance checklist

  • Changes are covered by tests.
  • Existing behavior is preserved for valid pipeline names.
  • Pipeline names exceeding the maximum length are handled safely.
  • The maximum length is defined as a named constant rather than a magic number.
  • No screenshots are required for this backend change.

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #632045 (closed)

Merge request reports

Loading
Loading