default build step drush install causes conflict with migrate_tools:5

Issue

Composer has unsatisfied dependencies since the build step installs the latest version of drush via:

      if [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then
        composer require --no-ansi -n --no-suggest drush/drush
      fi

The error is:

$ if [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then # collapsed multi-line command
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Using version ^10.4 for drush/drush
./composer.json has been updated
Gathering patches from patch file.
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Conclusion: remove drupal/migrate_tools 5.0.0
    - Conclusion: don't install drupal/migrate_tools 5.0.0
    - drush/drush 10.4.0 conflicts with drupal/migrate_tools[5.0.0].
    - drush/drush 10.4.0-rc1 conflicts with drupal/migrate_tools[5.0.0].
    - drush/drush 10.4.1 conflicts with drupal/migrate_tools[5.0.0].
    - drush/drush 10.4.2 conflicts with drupal/migrate_tools[5.0.0].
    - drush/drush 10.x-dev conflicts with drupal/migrate_tools[5.0.0].
    - Installation request for drupal/migrate_tools (locked at 5.0.0, required as ^5.0) -> satisfiable by drupal/migrate_tools[5.0.0].
    - Installation request for drush/drush ^10.4 -> satisfiable by drush/drush[10.4.0, 10.4.0-rc1, 10.4.1, 10.4.2, 10.x-dev].
Installation failed, reverting ./composer.json to its original content.

This is releated to:

  • https://github.com/drush-ops/drush/issues/4637
  • drupalspoons/migrate_tools#124 (comment 544458438)

A solution that worked for me was to override build step found in https://gitlab.com/mog33/gitlab-ci-drupal/-/raw/3.x-dev/.gitlab-ci/ci/01_build.yml in my local .gitlab-ci.yml file with the below version ... basically pinning the drush version to 10.3:

# 04-13-2021 DPG
# Override the default version as migrate_tools:5.0 conflicts with Drush:10.4 currently.
#
# For a project, this build part use composer install to get the Drupal code.
# For a theme this can be used with a specific script to build something
# (grunt, webpack, yarn...).
build:
  extends: .build_template
  rules:
    - if: '$SKIP_BUILD == "1"'
      when: never
    - when: always
  script:
    # Validate the composer.json file.
    - if [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then
      composer validate --no-check-all --no-check-publish -n --no-ansi;
      fi
    # Install the project.
    - if [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then
      composer install --no-ansi -n --prefer-dist;
      fi
    # Ensure we have Drupal Dev third party for next jobs, mostly PHPUnit.
    - if [ ! -f "vendor/bin/phpunit" ] && [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then
      composer require --no-ansi -n "drupal/core-dev:^${CI_DRUPAL_VERSION}";
      vendor/bin/phpunit --version;
      fi
    # Install behat and plugins with maximum memory.
    - |
      if [ ! -f "vendor/bin/behat" ] && [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then
        COMPOSER_MEMORY_LIMIT=-1 composer require --no-ansi -n --no-suggest \
          "bex/behat-screenshot:^1.2" \
          "dmore/behat-chrome-extension:^1.3" \
          "emuse/behat-html-formatter:0.1.*" \
          "drupal/drupal-extension:~4.1"
      fi
    - |
      if [ ${CI_TYPE} == "project" ] && [ -f composer.json ]; then
        composer require --no-ansi -n --no-suggest drush/drush:10.3
      fi
Assignee Loading
Time tracking Loading