Allow excluding `node_modules` folder from artifacts via variable
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3533957. --> Reported by: [fjgarlin](https://www.drupal.org/user/2495842) Related to !381 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>We often get pinged in the #gitlab channel or the issue queue about <code>ERROR: Uploading artifacts as "archive" to coordinator... 413 Request Entity Too Large</code>.</p> <p>We've had some issues where we have already ignored ".git" files, which helps when bringing "dev" packages. </p> <p>Howerver, looking at the size of one module artifact for the composer job, we can see (first numeric value is MB):</p> <pre>$ du -m ~/Downloads/artifacts-538085-composer | sort -nr | head -n 10<br><br>645 ~/Downloads/artifacts-538085-composer<br>546 ~/Downloads/artifacts-538085-composer/web<br>489 ~/Downloads/artifacts-538085-composer/web/core<br>364 ~/Downloads/artifacts-538085-composer/web/core/node_modules<br>118 ~/Downloads/artifacts-538085-composer/web/core/node_modules/@ckeditor<br>98 ~/Downloads/artifacts-538085-composer/vendor<br>66 ~/Downloads/artifacts-538085-composer/web/core/modules<br>57 ~/Downloads/artifacts-538085-composer/web/modules/contrib<br>57 ~/Downloads/artifacts-538085-composer/web/modules</pre><p>We can see that "node_modules" is responsible for more than 50% of the size of the artifact. It appears that the size of this folder for D11 is even bigger than for D10, so pipelines might be failing purely because of this.</p> <p>This issue is related <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-1"><a href="https://www.drupal.org/project/gitlab_templates/issues/3464400" title="Status: Active">#3464400: Consider merging the build and validate stages</a></span>, but probably broader in scope. This one is only about "node_modules" folder and we'd get a +50% reduction in artifact size.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Example: <a href="https://git.drupalcode.org/project/contribution_records/-/jobs/5765518">https://git.drupalcode.org/project/contribution_records/-/jobs/5765518</a></p> <p>Normal module with very few dependencies.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Exclude the "node_modules" folder in the "composer" artifact and run <code>yarn install</code> in the subsequent jobs where needed.<br> - stylelint<br> - eslint<br> - cspell<br> - .nightwatch-base</p> <p>If we don't want to risk BC (not sure how), we could do this behind a variable.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>MR</p>
issue