Spell-checking job fails with "Argument list too long" when too many files are changed

Created on 15 November 2023, 7 months ago
Updated 8 March 2024, 4 months ago

Problem/Motivation

When a merge request modifies too many files (around 1000) the 📔 Spell-checking job fails with "Argument list too long" errors.

$ export MODIFIED=`git diff --name-only refs/heads/$TARGET_BRANCH|while read r;do echo "$CI_PROJECT_DIR/$r";done|tr "\n" " "`
$ echo $MODIFIED | tr ' ' '\n' | yarn --cwd=./core run -s spellcheck:core --no-must-find-files --file-list stdin
/scripts-125737-332819/step_script: line 262: /usr/bin/tr: Argument list too long
/scripts-125737-332819/step_script: line 262: /usr/bin/yarn: Argument list too long

The maximum length of arguments is determined by getconf ARG_MAX. There are some docs about this in GitLab CI at https://docs.gitlab.com/ee/ci/variables/#argument-list-too-long

Aside: do we need a gitlab or ci component for these issues?

Steps to reproduce

https://git.drupalcode.org/issue/drupal-3399388/-/jobs/332819

Proposed resolution

Instead of piping the list of files to tr and again to yarn we can write the list to a file read it in the yarn command. Something like this:

git diff --name-only refs/heads/$TARGET_BRANCH|while read r;do echo "$CI_PROJECT_DIR/$r";done > ./core/modified.txt
yarn --cwd=./core run -s spellcheck:core --no-must-find-files --file-list modified.txt

Remaining tasks

  • Determine optimal command formatting / file location
  • Update .gitlab-ci.yml

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

🐛 Bug report
Status

Fixed

Version

10.2

Component
Other 

Last updated about 9 hours ago

Created by

🇦🇺Australia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024