Remove possible wrapping quotes from PROJECT_TYPE.

Issue information

From user: kristiaanvandeneynde

Related to !351 (merged)

Contribution record

Fork management

Problem/Motivation

#3506040: Create new variable DRUPAL_PROJECTS_PATH and use it to remove hardcoded "/custom" paths 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

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information