Broken path due to info file being read incorrectly

Created on 30 April 2025, 3 days ago

Problem/Motivation

Try to remove most of the hardcoded "/custom" paths and use DRUPAL_PROJECT_FOLDER to calculate the right ones Active introduced the following lines:

# If DRUPAL_PROJECTS_PATH has not been defined (via UI form or in custom .gitlab-ci.yml) then set to the default.
    [[ $DRUPAL_PROJECTS_PATH == "" ]] && export DRUPAL_PROJECTS_PATH="sites/all/${PROJECT_TYPE}s/custom" && echo "DRUPAL_PROJECTS_PATH=$DRUPAL_PROJECTS_PATH" >> build.env

In the logs of a weirdly failing test (it can't find a class that is there), I see this as such:

sudo -u www-data -H -E vendor/bin/phpunit  --bootstrap /builds/project/group/web/core/tests/bootstrap.php /builds/project/group/web/'module's/custom/group --log-junit /builds/project/group/junit.xml  

Note the broken path builds/project/group/web/'module's/custom/group

This is because Group specifies it's type in the info.yml file with single quotes, which is valid Yaml, and the script runs the following:

elif [[ $PROJECT_TYPE == "" ]]; then
      # If we have a project name, and project type has not been pre-defined, then read the corresponding .info.yml to get it.
      INFO_YML=$(find . -name "$PROJECT_NAME.info.yml" | head -1)
      export PROJECT_TYPE=$(sed -n -e 's/^[[:space:]]*type:[[:space:]]*//p' $INFO_YML | head -1 | tr '[:upper:]' '[:lower:]')

I've pushed a hotfix to the branch that manually sets PROJECT_TYPE to see if this fixes things, but I wanted to raise the bug report nonetheless as it doesn't seem right to have paths with single quotes in them.

Steps to reproduce

Specify a project type in an info.yml file using single quotes, see GitLab CI use the quotes in paths.

Proposed resolution

Take the possibility of quotes into account or otherwise sanitize the value from the info file.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Component

gitlab-ci

Created by

🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

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

Comments & Activities

Production build 0.71.5 2024