Allow copying or symlinking when building the project
Problem/Motivation
Maybe we don't need to do anything, or maybe we do.
#3397699: Preserve original composer.json in the modules directory and #3418831: Test-only job both led to the conclusion that our current building process is not ideal, as it modifies files from the project, so it's hard when we need to do git diff in MR-based workflows, or we have some issues with the symlinks (like when creating the cspell job).
So, quoting from one of those comments:
We could change the approach to building the project so that the original repo folder is pristine. For example: we could create a brand new folder, bring Drupal via composer there and do the expand_composer in that other folder. We'd just need to adjust the apache webroot paths after that. It's not a quick and easy one, but it's not a super complex one either.
Obviously, things are NOT broken, so they might not need fixing, but doing a refactoring that makes everything tidier and avoids the mentioned side effects might be a nice to have, and if we do it in a way that is fully BC then it might be worth exploring.
Steps to reproduce
Do a git diff after the composer step and you'll see that the "composer.json" file appears as changed, even tho we are preserving the pristine copy in the symlinked folder (git diff runs in the root folder).
Proposed resolution
Explore a different setup process.
Actual solution implemented
- Add a new variable
_COMPOSER_SYMLINKwhich can be set in .gitlab-ci.yml or via form UI - The default is 1 to preserve the existing behavior
- Set to 0 to make copies of the project's files and folders, instead of symlinks
Details start from comment #5