Change how the templates link the project into Drupal

Created on 21 January 2025, 4 months ago

Problem/Motivation

The current way that the project alters the composer.json under test and links files to a project directory is extremely fragile and has caused a number of bugs over time. For example πŸ› PHPCS error in contributed module caused by core recipe README.txt Active .

Proposed resolution

Alter the templates to not change the code under test at all. We should copy the project's composer.json to a different directory that is not part of the checkout code. We should then alter that composer json using the expand script and tell composer where to find the code under test. This can be achieved with something like

    - cd /some/other/path
    - composer config repositories.module path "$CI_PROJECT_DIR"
    - composer require "$PROJECT_NAME:@dev"

Remaining tasks

Work out all the steps to do this.

User interface changes

None

API changes

TBD

Data model changes

TBD

πŸ› Bug report
Status

Active

Component

gitlab-ci

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

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

Comments & Activities

  • Issue created by @alexpott
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    This just went in last week πŸ› PHPCS error in contributed module caused by core recipe.README.txt Active , and this ✨ Preserve original composer.json in the modules directory Fixed was done a while ago.

    So I'm not sure this is needed anymore.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @fjgarlin I disagree. The new code is still very fragile. For example, if the project contains a recipes folder then we're still going to place a readme (or overwrite it). We inherited this approach from Drupalspoons and whilst it has been great to get everything working it has shortcomings and breaks a principle - we should minimise (hopefully to zero) the things that we alter in code under test. The whole backup approach in ✨ Preserve original composer.json in the modules directory Fixed is complex and fraught.

  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Agree that it is still far from ideal, that's why I also created this a while back #3425971: Explore the posibility of a different setup for the project, composer expansion and symlinking process β†’ , but I haven't had the time to work on it.

    I definitely agree with the approach of having two folders, one for the full project, and one for the module, from there we can expand and work things out, but my main worry is how many pipelines we fix vs how many we break, especially if they have customisations on the jobs.

    In any case, this is something that we want/need to improve, so I'll leave this open as it is more recent. I'm almost sure that we would not be able to keep things BC, so if that'd be the case, we'd need to work on a strategy for it, but that's out of the scope for this issue.

    I suggest creating a brand new file in the includes folder, which we can start as a copy of include.drupalci.main.yml and then start changing code on that new file. We'd be able to easily test it by changing a reference to the new file if/when needed.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @fjgarlin yep BC is going to be a PITA. And I think I agree we should have a way to coordinate a switch over. Another way of thinking about this might be to change this project's release strategy. This change should be a new major version and people should be able to stick on the last major version if they need and then update when they have time. Most projects will not have customised there pipelines to the point they rely on the layout so they will be fine. The projects that break can change to include the previous major version and add a ticket to update to the new major version.

  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Any major effort into refactoring things should probably be done via GitLab components ✨ See we if can and/or should transfer the templates into GitLab CI/CD components Active .

    I've tagged issues from the queue which I think were part of a possible 2.x conversation, see them here: https://www.drupal.org/project/issues/search?text=&projects=GitLab+Templ... β†’

    I don't think that we have the capacity right now at the DA to work on this, as there are other priorities way ahead of this, and this project itself, while not perfect, can be considered stable and is working mostly well. So, there are no immediate plans to start working on a 2.x effort, but we can start seeing what could be needed via the previous tag at least.

Production build 0.71.5 2024