Skip to content

Truncate CI_MERGE_REQUEST_DESCRIPTION if it's too big

What happened

We hit into an issue that when the merge request description is very large, runners cannot properly run any jobs for the merge request pipelines: !137027 (comment 1664370098)

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

Which can be observed at https://gitlab.com/gitlab-org/gitlab/-/jobs/5605850699

The description was 675K in text.

Expected result

Set a limit to CI_MERGE_REQUEST_DESCRIPTION so it will never give this error and run the jobs with a truncated CI_MERGE_REQUEST_DESCRIPTION without the full text.

Background

We have the error documented: https://docs.gitlab.com/ee/ci/variables/#argument-list-too-long

However having a super big CI_MERGE_REQUEST_DESCRIPTION causing this error is new. A similar problem can happen when the commit message is super large is also mentioned at: #392406 (comment 1424768580)

A similar limit should be applied to the CI variables which carry the commit message as well. See also #431626 where CI_COMMIT_MESSAGE was used as an example.

Proposal

  1. Automatically limit CI_MERGE_REQUEST_DESCRIPTION to 1KiB; if the size is exceeded, automatically truncate the remaining text.
  2. Introduce a boolean variable to indicate if the message was truncated.
Edited by Jocelyn Eillis