Skip to content

Truncate a CI_MERGE_REQUEST_DESCRIPTION if it's too big

What does this MR do and why?

Related to issue: #432846 (closed)

We encountered an issue where excessively long merge request descriptions caused runners to fail in executing jobs for the associated pipelines.

The error from the runner is:

exec /usr/bin/dumb-init: argument list too long
ERROR: Job failed: prepare environment: exit code 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

As we agreed on the issue #432846 (closed) : We have to limit CI_MERGE_REQUEST_DESCRIPTION to 2500 characters length

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

  1. Create a .gitlab-ci.yml
stages:
- test_predefined
test-predefined-job:
  stage: test_predefined
  script:
  - echo "expose CI_MERGE_REQUEST_DESCRIPTION ="
  - echo "$CI_MERGE_REQUEST_DESCRIPTION"
  - echo "expose CI_MERGE_REQUEST_DESCRIPTION_IS_TRUNCATED ="
  - echo "$CI_MERGE_REQUEST_DESCRIPTION_IS_TRUNCATED"
  rules:
  - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
  1. Create a Merge request with a description - image
  2. Enable a FF Feature.enable(:truncate_ci_merge_request_description)
  3. Test job pipelines

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 Dmytro Biryukov

Merge request reports