CI always failing on tags for phpcs and phsptan

Created on 20 November 2024, 8 months ago

Problem/Motivation

The CI pipelines seem to be always failing for tags: https://git.drupalcode.org/project/drupal/-/tags
This is due to trying to get the "-dev" version, but as it is a tag, that's not valid.

Steps to reproduce

https://git.drupalcode.org/project/drupal/-/tags

Proposed resolution

Either fix the version that the script is expecting or just do not run the jobs on tags.

Remaining tasks

MR

User interface changes

CI results for tag pipelines will be green :-)

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

phpunit

Created by

πŸ‡ͺπŸ‡ΈSpain fjgarlin

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

Merge Requests

Comments & Activities

  • Issue created by @fjgarlin
  • Pipeline finished with Failed
    8 months ago
    #344824
  • Merge request !10270Add exception to jobs in tags. β†’ (Open) created by fjgarlin
  • Pipeline finished with Failed
    8 months ago
    #344826
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    I added a rule in a place that is used by multiple jobs, but I think it might actually be ok, as I'm not sure if we need these jobs to run on tags.
    I'd say this is ready for review.

  • Pipeline finished with Success
    8 months ago
    Total: 519s
    #344846
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Think we should merge and see if it works.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    If we don't want CI to run on tag, should this just be in workflow:rules somewhere?

    Alternatively, we could figure out why composer validate fails when run on a tag, because that seems a bit strange.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    So the issue is

      COMPOSER_ROOT_VERSION: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev"
    

    For tags neither of those variables are set and this results in the error:

    $ COMPOSER_ROOT_VERSION=-dev composer validate
    
    In VersionParser.php line 191:
                                     
      Invalid version string "-dev"                               
    

    I think any job that uses composer is going to fail in the same way. The suggested fix skips any of the lint jobs, but I think the default test job will now try to run? But that will presumably also fail.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Looking at the table at https://docs.gitlab.com/ee/ci/jobs/job_rules.html#run-jobs-only-in-speci...

    Maybe if we want to only run on branches we should change

        # Run on commits.
        - if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project"
        # The last rule above blocks manual and scheduled pipelines on non-default branch. The rule below allows them:
        - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_ROOT_NAMESPACE == "project"
    

    to

        # Run on push to branch or scheduled branches.
        - if: $CI_COMMIT_BRANCH && $CI_PROJECT_ROOT_NAMESPACE == "project"
    
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Alternatively if we do want CI to run on tags then maybe we should set COMPOSER_ROOT_VERSION in the rules section, where we can use different variables to construct it depending on the pipeline source? This is allowed according to docs: https://docs.gitlab.com/ee/ci/yaml/#rulesvariables - this also feels a bit more neat than relying on one or the other to be set in ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev".

Production build 0.71.5 2024