[Gitlab] Pipeline task fails

Created on 31 January 2025, 3 months ago

Problem/Motivation

Issue with PHPCs and PHPStan during pipeline execution:

For example:

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

🇵🇱Poland damian.skiba

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

Merge Requests

Comments & Activities

  • Issue created by @damian.skiba
  • First commit to issue fork.
  • Pipeline finished with Canceled
    2 months ago
    Total: 182s
    #411528
  • Pipeline finished with Success
    2 months ago
    Total: 372s
    #411531
  • Merge request !18#3503626 Change value of _WEB_ROOT → (Merged) created by jonathan1055
  • Pipeline finished with Success
    2 months ago
    Total: 506s
    #411886
  • Pipeline finished with Success
    2 months ago
    Total: 322s
    #411896
  • Pipeline finished with Success
    2 months ago
    Total: 463s
    #411899
  • Pipeline finished with Success
    2 months ago
    Total: 176s
    #411906
  • Pipeline finished with Success
    2 months ago
    Total: 220s
    #411913
  • Pipeline finished with Success
    2 months ago
    Total: 373s
    #411926
  • Pipeline finished with Success
    2 months ago
    Total: 337s
    #411942
  • Pipeline finished with Success
    2 months ago
    Total: 201s
    #411951
  • Pipeline finished with Success
    2 months ago
    Total: 239s
    #411956
  • Pipeline finished with Success
    2 months ago
    Total: 195s
    #411979
  • Pipeline finished with Canceled
    2 months ago
    Total: 117s
    #411986
  • Pipeline finished with Success
    2 months ago
    Total: 210s
    #411987
  • Pipeline finished with Success
    2 months ago
    Total: 201s
    #412008
  • Pipeline finished with Success
    2 months ago
    Total: 200s
    #412011
  • 🇬🇧United Kingdom jonathan1055

    Thanks for opening this issue. I have used it to test out some ideas about how to make phpcs ignore certain folders in a project's own directory structure. I created a phpcs.xml.dist file in the project top folder, but it also required some customization in the actual phpcs: script: part of the pipeline. Here is a summary of the results, which shows in principle that this works:

    Added one phpcs fault. Added -v to show which files are now being checked. The log shows:

    Registering sniffs in the droopler standard... DONE (131 sniffs registered)
    Creating file list... DONE (16 files in queue)

    When the 'web' folder is correctly ignore there are just 16 files which are considered to contain php code.
    https://git.drupalcode.org/issue/droopler-3503626/-/jobs/4209476

    Without -v verbose output
    https://git.drupalcode.org/issue/droopler-3503626/-/jobs/4209827

    Removed the forced error, all clean green
    https://git.drupalcode.org/issue/droopler-3503626/-/jobs/4209839

    MR18 is not ready for committing, because the customizations should really be done in Gitlab Templates, see Add basepath parameter to PHP Code Sniffer Active . When that issue is ready I will use this MR to test it.

  • Pipeline finished with Failed
    2 months ago
    #412442
  • Pipeline finished with Failed
    2 months ago
    #412443
  • Pipeline finished with Success
    2 months ago
    Total: 2054s
    #412444
  • Pipeline finished with Success
    2 months ago
    Total: 485s
    #412466
  • Pipeline finished with Success
    2 months ago
    Total: 172s
    #412485
  • Pipeline finished with Success
    2 months ago
    Total: 170s
    #412596
  • Pipeline finished with Success
    2 months ago
    Total: 163s
    #412649
  • Pipeline finished with Success
    2 months ago
    Total: 168s
    #413627
  • Pipeline finished with Success
    2 months ago
    Total: 173s
    #413632
  • Pipeline finished with Success
    2 months ago
    Total: 168s
    #413755
  • 🇬🇧United Kingdom jonathan1055

    I have found a simpler way for you to fix the phpcs and phpstan problems, and not have to pin your Gitlab Templates version to 1.6.14 but allow you to return to using the default version. The recursion problems in PHPStan were due to this project having a /web/ folder at the top of the project repository. This is a perfectly valid thing to do, and you do not need to change it. The problem is that the pipeline build process also creates a 'web' folder at top level. The name of this folder is arbitrary and we already provide a variable _WEB_ROOT to hold the value, which defaults to 'web'. But if you specify a different name in your .gitlab-ci.yml file then the problems do not occur.

    MR18 now demonstrates this - see the pipeline https://git.drupalcode.org/issue/droopler-3503626/-/pipelines/413632
    The phpstan job runs and passes green.
    The phpcs job now validly checks your project's 'web' folder, and we see

    Registering sniffs in the drupal-project standard... DONE (131 sniffs registered)
    Creating file list... DONE (24 files in queue)
    FILE: web/profiles/droopler/src/Form/RecipesForm.php
    -------------------------------------------------------------------------
    FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
    

    These are valid phpcs errors and warnings, they were not being reported previously because the "web" folder was being ignored (regardless of whether a project had their own or not). That problem was fixed in gitlab templates issue 🐛 PHPCS error in contributed module caused by core recipe.README.txt Active which is what exposed the problem you reported.

    I have removed the testing changes, so MR18 is now ready for review

  • 🇵🇱Poland damian.skiba

    Thank you, Jonathan1055 and Fjgarlin, for your help with resolving the issue.

  • 🇬🇧United Kingdom jonathan1055

    You are welcome, and thank you for bringing the problem to our attention. We are working on a solution to detect when the project has a directory matching _$WEB_ROOT and give an informative message in the log.

Production build 0.71.5 2024