From 083d4c0ac697b8e497055bbd3724ea9e7e71c0fb Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 05:27:07 +0000 Subject: [PATCH 01/12] fix: support drupal 11 --- .ddev/config.yaml | 2 +- .gitignore | 1 + .../drupalpod-setup/drupal_setup_core.sh | 8 +- .../drupal/drupalpod-setup/drupalpod-setup.sh | 23 ++++ .gitpod/drupal/drupalpod-setup/setup_env.sh | 3 +- .gitpod/utils/ddev-in-gitpod-setup.sh | 24 +++- .../13/DevelopmentProjectCommands.php | 121 ++++++++++++++++++ 7 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 src/drush-commands-core-development/13/DevelopmentProjectCommands.php diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 3ab0b386..e25a2c35 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -1,7 +1,7 @@ name: DrupalPod type: drupal10 docroot: web -php_version: "8.1" +php_version: "8.3" webserver_type: nginx-fpm xdebug_enabled: false additional_hostnames: [] diff --git a/.gitignore b/.gitignore index 23bd1965..1b5d2424 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ src/**/out/ src/**/*.vsix src/**/.vscode-test/ drush/ +.ddev/config.gitpod.yaml diff --git a/.gitpod/drupal/drupalpod-setup/drupal_setup_core.sh b/.gitpod/drupal/drupalpod-setup/drupal_setup_core.sh index d3d13029..cea31188 100644 --- a/.gitpod/drupal/drupalpod-setup/drupal_setup_core.sh +++ b/.gitpod/drupal/drupalpod-setup/drupal_setup_core.sh @@ -31,9 +31,15 @@ cd "${GITPOD_REPO_ROOT}" && # Removing the conflict part of composer echo "$(cat composer.json | jq 'del(.conflict)' --indent 4)" >composer.json +# If a core issue branch was chosen, we want the version of Drupal core that is in that issue branch +# This is very helpful for issues that started with previous Drupal core versions, and the issue version automatically got updated to latest current drupal version +if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_BRANCH" ]; then + time composer require drupal/core-recommended:* drupal/core-project-message:* drupal/core-composer-scaffold:* --no-update +fi + # Only after composer update, /web/core get symlinked to /repos/drupal/core # repos/drupal/core -> web/core -time composer update --lock +time composer update # vendor -> repos/drupal/vendor if [ ! -L "$GITPOD_REPO_ROOT"/repos/drupal/vendor ]; then diff --git a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh index 01122eb7..d914c693 100755 --- a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh +++ b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh @@ -26,6 +26,29 @@ if [ -n "$DEBUG_SCRIPT" ] || [ -n "$GITPOD_HEADLESS" ]; then set -x fi +convert_version() { + local version=$1 + if [[ $version =~ "-" ]]; then + # Remove the part after the dash and replace the last numeric segment with 'x' + local base_version=${version%-*} + echo "${base_version%.*}.x" + else + echo "$version" + fi +} + +# Test cases +# echo $(convert_version "9.2.5-dev1") # Output: 9.2.x +# echo $(convert_version "9.2.5") # Output: 9.2.5 +# echo $(convert_version "10.1.0-beta1") # Output: 10.1.x +# echo $(convert_version "11.0-dev") # Output: 11.x + +# If this is an issue fork of Drupal core - set the drupal core version based on that issue fork +if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then + export VERSION_FROM_GIT=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') + export DP_CORE_VERSION=$(convert_version $VERSION_FROM_GIT) +fi + time ddev start # Measure the time it takes to go through the script diff --git a/.gitpod/drupal/drupalpod-setup/setup_env.sh b/.gitpod/drupal/drupalpod-setup/setup_env.sh index 15cfb522..85cd6b49 100644 --- a/.gitpod/drupal/drupalpod-setup/setup_env.sh +++ b/.gitpod/drupal/drupalpod-setup/setup_env.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash # Set the default setup during prebuild process -if [ -n "$GITPOD_HEADLESS" ]; then +if [ -z "$DP_PROJECT_TYPE" ]; then export DP_INSTALL_PROFILE='demo_umami' export DP_EXTRA_DEVEL=1 export DP_EXTRA_ADMIN_TOOLBAR=1 - export DP_PROJECT_TYPE='default_drupalpod' fi diff --git a/.gitpod/utils/ddev-in-gitpod-setup.sh b/.gitpod/utils/ddev-in-gitpod-setup.sh index 3ec199f5..5f1776a1 100755 --- a/.gitpod/utils/ddev-in-gitpod-setup.sh +++ b/.gitpod/utils/ddev-in-gitpod-setup.sh @@ -3,10 +3,26 @@ if [ -n "$DEBUG_SCRIPT" ] || [ -n "$GITPOD_HEADLESS" ]; then set -x fi -# Set the default PHP version to 8.1 -if [ -z "$DP_PHP_VERSION" ]; then - DP_PHP_VERSION="8.1" +# If this is an issue fork of Drupal core - set the drupal core version based on that issue fork +if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then + export VERSION_FROM_GIT=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') fi +# set PHP version, based on https://www.drupal.org/docs/getting-started/system-requirements/php-requirements#versions +major_version=$(echo $VERSION_FROM_GIT | cut -d '.' -f 1) +minor_version=$(echo $VERSION_FROM_GIT | cut -d '.' -f 2) + +# Before Drupal 10.2, we should use php 8.2, otherwise use php 8.3 +if (( major_version < 10 )) || { (( major_version == 10 )) && (( minor_version < 2 )); }; then + php_version="8.2" +else + php_version="8.3" +fi + +cat < .ddev/config.gitpod.yaml +#ddev-gitpod-generated +php_version: "$php_version" +CONFIGEND + # Misc housekeeping before start -ddev config global --instrumentation-opt-in=false +ddev config global --instrumentation-opt-in=true diff --git a/src/drush-commands-core-development/13/DevelopmentProjectCommands.php b/src/drush-commands-core-development/13/DevelopmentProjectCommands.php new file mode 100644 index 00000000..85ac1cfc --- /dev/null +++ b/src/drush-commands-core-development/13/DevelopmentProjectCommands.php @@ -0,0 +1,121 @@ +get('loader') + ); + + return $commandHandler; + } + + /** + * @hook replace-command cache:rebuild + */ + public function rebuild($options = ['cache-clear' => true]) { + if (!$options['cache-clear']) { + $this->logger()->info(dt("Skipping cache-clear operation due to --no-cache-clear option.")); + return true; + } + + // CHANGE: Get the app root ourselves instead of using DRUPAL_ROOT. + $app_root = $this->getAppRoot(); + chdir($this->getAppRoot()); + + // We no longer clear APC and similar caches as they are useless on CLI. + // See https://github.com/drush-ops/drush/pull/2450 + + require_once DRUSH_DRUPAL_CORE . '/includes/utility.inc'; + + $request = Drush::bootstrap()->getRequest(); + DrupalKernel::bootEnvironment(); + + // Avoid 'Only variables should be passed by reference' + // CHANGE: Don't use DRUPAL_ROOT. + $root = $app_root; + $site_path = DrupalKernel::findSitePath($request); + Settings::initialize($root, $site_path, $this->autoloader); + + // drupal_rebuild() calls drupal_flush_all_caches() itself, so we don't do it manually. + // CHANGE: call our own version of drupal_rebuild(). + $this->drupal_rebuild($this->autoloader, $request); + $this->logger()->success(dt('Cache rebuild complete.')); + } + + /** + * Replacement for drupal_rebuild(). + * + * This passes the app root to DrupalKernel. + */ + function drupal_rebuild($class_loader, Request $request) { + // Remove Drupal's error and exception handlers; they rely on a working + // service container and other subsystems and will only cause a fatal error + // that hides the actual error. + restore_error_handler(); + restore_exception_handler(); + + // Invalidate the container. + // Bootstrap up to where caches exist and clear them. + // CHANGE: Pass the correct app root to DrupalKernel. + $kernel = new DrupalKernel('prod', $class_loader, TRUE, $this->getAppRoot()); + $kernel->setSitePath(DrupalKernel::findSitePath($request)); + $kernel->invalidateContainer(); + $kernel->boot(); + $kernel->preHandle($request); + // Ensure our request includes the session if appropriate. + if (PHP_SAPI !== 'cli') { + $request->setSession($kernel->getContainer()->get('session')); + } + + drupal_flush_all_caches($kernel); + + // Disable recording of cached pages. + \Drupal::service('page_cache_kill_switch')->trigger(); + + // Restore Drupal's error and exception handlers. + // @see \Drupal\Core\DrupalKernel::boot() + set_error_handler('_drupal_error_handler'); + set_exception_handler('_drupal_exception_handler'); + } + + /** + * Gets the app root. + * + * @return string + * The app root. + */ + protected function getAppRoot(): string { + // This core belongs to the project template, so we can hardcode the + // location of this file relative to the project root, and the scaffold + // location defined in the project's composer.json. + return dirname(__DIR__, 3) . '/web'; + } + +} From 486d154d2288482abd6efc25ecc3e43bcb6c541f Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 05:53:11 +0000 Subject: [PATCH 02/12] fix: improve code --- .gitpod/drupal/drupalpod-setup/drupalpod-setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh index d914c693..a78c1bfb 100755 --- a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh +++ b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh @@ -45,8 +45,9 @@ convert_version() { # If this is an issue fork of Drupal core - set the drupal core version based on that issue fork if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then - export VERSION_FROM_GIT=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') - export DP_CORE_VERSION=$(convert_version $VERSION_FROM_GIT) + VERSION_FROM_GIT=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') + DP_CORE_VERSION=$(convert_version "$VERSION_FROM_GIT") + export DP_CORE_VERSION fi time ddev start From e6a9b87893a518d2aac6dbb1dc1af6ef4411e8d2 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 05:54:12 +0000 Subject: [PATCH 03/12] fix: default installation --- .gitpod/drupal/drupalpod-setup/setup_env.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitpod/drupal/drupalpod-setup/setup_env.sh b/.gitpod/drupal/drupalpod-setup/setup_env.sh index 85cd6b49..193cc3d0 100644 --- a/.gitpod/drupal/drupalpod-setup/setup_env.sh +++ b/.gitpod/drupal/drupalpod-setup/setup_env.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash -# Set the default setup during prebuild process +# Set a default setup if project type wasn't specified if [ -z "$DP_PROJECT_TYPE" ]; then export DP_INSTALL_PROFILE='demo_umami' + export DP_PROJECT_TYPE='project_core' + export DP_PROJECT_NAME="drupal" + export DP_CORE_VERSION='10.2.5' export DP_EXTRA_DEVEL=1 export DP_EXTRA_ADMIN_TOOLBAR=1 fi From 5f8af1b5774f06960d78fdbd7ec2b117b756a122 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 05:56:51 +0000 Subject: [PATCH 04/12] fix: update mariadb version to 10.6 --- .ddev/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index e25a2c35..c404a6c7 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -8,7 +8,7 @@ additional_hostnames: [] additional_fqdns: [] database: type: mariadb - version: "10.4" + version: "10.6" use_dns_when_possible: true composer_version: "2" web_environment: [] From 8f0b7f1746a09f0d9d8732cb93dc8e1d1c7071d6 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 06:54:19 +0000 Subject: [PATCH 05/12] fix: update ddev-gitpod image (latest ddev version) --- .ddev/config.yaml | 26 ++++++++++++++++---------- .gitpod.yml | 2 +- .gitpod/README.md | 2 ++ .gitpod/images/Dockerfile | 23 +++++++++++++++++++---- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index c404a6c7..b56b4972 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -1,5 +1,5 @@ name: DrupalPod -type: drupal10 +type: drupal docroot: web php_version: "8.3" webserver_type: nginx-fpm @@ -12,19 +12,21 @@ database: use_dns_when_possible: true composer_version: "2" web_environment: [] +corepack_enable: false # Key features of DDEV's config.yaml: # name: # Name of the project, automatically provides # http://projectname.ddev.site and https://projectname.ddev.site -# type: # backdrop, craftcms, django4, drupal6/7/8/9/10, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress -# See https://ddev.readthedocs.io/en/latest/users/quickstart/ for more +# type: # backdrop, craftcms, django4, drupal, drupal6, drupal7, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress +# See https://ddev.readthedocs.io/en/stable/users/quickstart/ for more # information on the different project types +# "drupal" covers recent Drupal 8+ # docroot: # Relative path to the directory containing index.php. -# php_version: "8.1" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3" +# php_version: "8.2" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3" # You can explicitly specify the webimage but this # is not recommended, as the images are often closely tied to DDEV's' behavior, @@ -34,7 +36,7 @@ web_environment: [] # database: # type: # mysql, mariadb, postgres -# version: # database version, like "10.4" or "8.0" +# version: # database version, like "10.11" or "8.0" # MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0 # PostgreSQL versions can be 9-16. @@ -75,7 +77,7 @@ web_environment: [] # Alternatively, an explicit Composer version may be specified, for example "2.2.18". # To reinstall Composer after the image was built, run "ddev debug refresh". -# nodejs_version: "18" +# nodejs_version: "20" # change from the default system Node.js version to any other version. # Numeric version numbers can be complete (i.e. 18.15.0) or # incomplete (18, 17.2, 16). 'lts' and 'latest' can be used as well along with @@ -84,6 +86,9 @@ web_environment: [] # Note that you can continue using 'ddev nvm' or nvm inside the web container # to change the project's installed node version if you need to. +# corepack_enable: false +# Change to 'true' to 'corepack enable' and gain access to latest versions of yarn/pnpm + # additional_hostnames: # - somename # - someothername @@ -141,8 +146,8 @@ web_environment: [] # - "mutagen": enables Mutagen for this project. # - "nfs": enables NFS for this project. # -# See https://ddev.readthedocs.io/en/latest/users/install/performance/#nfs -# See https://ddev.readthedocs.io/en/latest/users/install/performance/#mutagen +# See https://ddev.readthedocs.io/en/stable/users/install/performance/#nfs +# See https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen # fail_on_hook_fail: False # Decide whether 'ddev start' should be interrupted by a failing hook @@ -274,5 +279,6 @@ web_environment: [] # for them. Example: #hooks: # post-import-db: -# - exec: drush cr -# - exec: drush updb +# - exec: drush sql:sanitize +# - exec: drush updatedb +# - exec: drush cache:rebuild diff --git a/.gitpod.yml b/.gitpod.yml index 7709cb22..2839de21 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: drupalpod/drupalpod-gitpod-base:20231222 +image: drupalpod/drupalpod-gitpod-base:20240419 # DDEV and composer are running as part of the prebuild # when starting a workspace all docker images are ready diff --git a/.gitpod/README.md b/.gitpod/README.md index 5e779f8e..658c01bd 100644 --- a/.gitpod/README.md +++ b/.gitpod/README.md @@ -4,8 +4,10 @@ 1. Update `.gitpod/images/Dockerfile`: + 1. Update `ddev` latest version. 1. Update `minio` latest version. 1. Update `gitui` latest version. + 1. Update `lazygit` latest version. 1. Generate new custom docker image: diff --git a/.gitpod/images/Dockerfile b/.gitpod/images/Dockerfile index d19764c9..9a9290ce 100644 --- a/.gitpod/images/Dockerfile +++ b/.gitpod/images/Dockerfile @@ -8,20 +8,35 @@ RUN sudo apt-get -qq install -y dialog # Install DDEV USER gitpod +# Add DDEV’s GPG key to your keyring +RUN sudo sh -c 'echo ""' RUN sudo install -m 0755 -d /etc/apt/keyrings RUN curl -fsSL https://pkg.ddev.com/apt/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/ddev.gpg > /dev/null RUN sudo chmod a+r /etc/apt/keyrings/ddev.gpg + +# Add DDEV releases to your package repository +RUN sudo sh -c 'echo ""' RUN echo "deb [signed-by=/etc/apt/keyrings/ddev.gpg] https://pkg.ddev.com/apt/ * *" | sudo tee /etc/apt/sources.list.d/ddev.list >/dev/null + +# Update package information and install DDEV +RUN sudo sh -c 'echo ""' RUN sudo apt update && sudo apt install -y ddev # Install GitUI (terminal-ui for git) -RUN wget https://github.com/extrawurst/gitui/releases/download/v0.24.3/gitui-linux-musl.tar.gz -P /tmp -RUN sudo tar xzf /tmp/gitui-linux-musl.tar.gz -C /usr/bin +ARG GITUI_VERSION=v0.26.1 +RUN wget https://github.com/extrawurst/gitui/releases/download/${GITUI_VERSION}/gitui-linux-x86_64.tar.gz -P /tmp +RUN sudo tar xzf /tmp/gitui-linux-x86_64.tar.gz -C /usr/bin + +# Install LazyGit (terminal-ui for git) +RUN wget https://github.com/jesseduffield/lazygit/releases/download/v0.41.0/lazygit_0.41.0_Darwin_x86_64.tar.gz -P /tmp +RUN tar -C /tmp -xf /tmp/lazygit_0.41.0_Darwin_x86_64.tar.gz +RUN sudo install /tmp/lazygit /usr/local/bin # (get latest Minio version from https://dl.min.io/client/mc/release/linux-amd64/) # Install Minio client -RUN wget https://dl.min.io/client/mc/release/linux-amd64/mcli_20231220071422.0.0_amd64.deb -RUN sudo dpkg -i mcli_20231220071422.0.0_amd64.deb +ARG MINIO_CLIENT_VERSION=mcli_20240418164529.0.0_amd64.deb +RUN wget https://dl.min.io/client/mc/release/linux-amd64/${MINIO_CLIENT_VERSION} +RUN sudo dpkg -i ${MINIO_CLIENT_VERSION} RUN sudo mv /usr/local/bin/mcli /usr/local/bin/mc # End workspace-base From bd75918758ef1fbb8ed21b275f867943be8cb575 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 07:24:10 +0000 Subject: [PATCH 06/12] fix: lazygit binaries --- .gitpod/images/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitpod/images/Dockerfile b/.gitpod/images/Dockerfile index 9a9290ce..d52a90e7 100644 --- a/.gitpod/images/Dockerfile +++ b/.gitpod/images/Dockerfile @@ -28,8 +28,8 @@ RUN wget https://github.com/extrawurst/gitui/releases/download/${GITUI_VERSION}/ RUN sudo tar xzf /tmp/gitui-linux-x86_64.tar.gz -C /usr/bin # Install LazyGit (terminal-ui for git) -RUN wget https://github.com/jesseduffield/lazygit/releases/download/v0.41.0/lazygit_0.41.0_Darwin_x86_64.tar.gz -P /tmp -RUN tar -C /tmp -xf /tmp/lazygit_0.41.0_Darwin_x86_64.tar.gz +RUN wget https://github.com/jesseduffield/lazygit/releases/download/v0.41.0/lazygit_0.41.0_Linux_x86_64.tar.gz -P /tmp +RUN tar -C /tmp -xf /tmp/lazygit_0.41.0_Linux_x86_64.tar.gz RUN sudo install /tmp/lazygit /usr/local/bin # (get latest Minio version from https://dl.min.io/client/mc/release/linux-amd64/) From cb89d1191a0aad3648bd36741fbdc309cf9f2994 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 07:24:55 +0000 Subject: [PATCH 07/12] fix: remove legacy settings from gitpod.yml --- .gitpod.yml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 2839de21..e00f99ea 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -76,22 +76,3 @@ ports: name: xdebug description: xdebug onOpen: ignore - -github: - prebuilds: - # enable for the master/default branch (defaults to true) - master: true - # enable for all branches in this repo (defaults to false) - branches: true - # enable for pull requests coming from this repo (defaults to true) - pullRequests: true - # enable for pull requests coming from forks (defaults to false) - pullRequestsFromForks: false - # add a check to pull requests (defaults to true) - addCheck: true - # add a "Review in Gitpod" button as a comment to pull requests (defaults to false) - addComment: false - # add a "Review in Gitpod" button to the pull request's description (defaults to false) - addBadge: true - # add a label once the prebuild is ready to pull requests (defaults to false) - addLabel: true From f61627b539431779b9d183de0fbc03e9c74475b9 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Fri, 19 Apr 2024 15:46:56 +0000 Subject: [PATCH 08/12] fix: use DP_CORE_VERSION when there's no issue_fork --- .../drupal/drupalpod-setup/drupal_version_specifics.sh | 4 ++-- .gitpod/utils/ddev-in-gitpod-setup.sh | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh b/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh index 0991e451..7dc2b779 100644 --- a/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh +++ b/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh @@ -12,8 +12,8 @@ fi # Adding support for composer-drupal-lenient - https://packagist.org/packages/mglaman/composer-drupal-lenient if [[ "$DP_CORE_VERSION" =~ ^11(\..*)?$ ]]; then # admin_toolbar and devel are not compatible yet with Drupal 11 - DP_EXTRA_ADMIN_TOOLBAR= - DP_EXTRA_DEVEL= + export DP_EXTRA_ADMIN_TOOLBAR= + export DP_EXTRA_DEVEL= if [ "$DP_PROJECT_TYPE" != "project_core" ]; then export COMPOSER_DRUPAL_LENIENT=mglaman/composer-drupal-lenient else diff --git a/.gitpod/utils/ddev-in-gitpod-setup.sh b/.gitpod/utils/ddev-in-gitpod-setup.sh index 5f1776a1..2bd08c86 100755 --- a/.gitpod/utils/ddev-in-gitpod-setup.sh +++ b/.gitpod/utils/ddev-in-gitpod-setup.sh @@ -5,12 +5,14 @@ fi # If this is an issue fork of Drupal core - set the drupal core version based on that issue fork if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then - export VERSION_FROM_GIT=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') + DRUPAL_CORE_VERSION=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') +else + DRUPAL_CORE_VERSION=$DP_CORE_VERSION fi # set PHP version, based on https://www.drupal.org/docs/getting-started/system-requirements/php-requirements#versions -major_version=$(echo $VERSION_FROM_GIT | cut -d '.' -f 1) -minor_version=$(echo $VERSION_FROM_GIT | cut -d '.' -f 2) +major_version=$(echo $DRUPAL_CORE_VERSION | cut -d '.' -f 1) +minor_version=$(echo $DRUPAL_CORE_VERSION | cut -d '.' -f 2) # Before Drupal 10.2, we should use php 8.2, otherwise use php 8.3 if (( major_version < 10 )) || { (( major_version == 10 )) && (( minor_version < 2 )); }; then From ff6f14e5b14fd32dcd27f74066b47c51e0bbe702 Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Sun, 21 Apr 2024 16:17:32 +0000 Subject: [PATCH 09/12] fix: temp debug --- .gitpod.yml | 2 ++ .gitpod/drupal/drupalpod-setup/drupalpod-setup.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index e00f99ea..a6b6080c 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,6 +4,8 @@ image: drupalpod/drupalpod-gitpod-base:20240419 # when starting a workspace all docker images are ready tasks: - init: | + printenv | grep DP_ + echo gitpod-yml !!! .gitpod/utils/send-a-message-gcs.sh > /tmp/output1.txt .gitpod/utils/ddev-in-gitpod-setup.sh .gitpod/utils/set-base-environment.sh diff --git a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh index a78c1bfb..95a32e77 100755 --- a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh +++ b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -eu -o pipefail +set -eu -o -x pipefail # Initialize all variables with null if they do not exist : "${DEBUG_SCRIPT:=}" @@ -19,6 +19,9 @@ set -eu -o pipefail : "${DP_MODULE_VERSION:=}" : "${DP_PATCH_FILE:=}" +echo after!!! +printenv | grep DP + # Assuming .sh files are in the same directory as this script DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" From 348255aafe45ac0990b726fa56faf6d340d8ae5b Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Sun, 21 Apr 2024 18:43:03 +0000 Subject: [PATCH 10/12] fix: reorganize scripts order --- .gitpod.yml | 1 - .gitpod/drupal/drupalpod-setup/cleanup.sh | 8 ++ .gitpod/drupal/drupalpod-setup/ddev_setup.sh | 20 ++++ .../drupal_version_specifics.sh | 22 ----- .../drupal/drupalpod-setup/drupalpod-setup.sh | 98 +++---------------- .../{setup_env.sh => fallback_setup.sh} | 0 .gitpod/drupal/drupalpod-setup/git_setup.sh | 71 ++++++++++++++ .../drupal/drupalpod-setup/install_modules.sh | 21 ++++ .gitpod/utils/ddev-in-gitpod-setup.sh | 23 ----- 9 files changed, 132 insertions(+), 132 deletions(-) create mode 100644 .gitpod/drupal/drupalpod-setup/cleanup.sh create mode 100644 .gitpod/drupal/drupalpod-setup/ddev_setup.sh delete mode 100644 .gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh rename .gitpod/drupal/drupalpod-setup/{setup_env.sh => fallback_setup.sh} (100%) create mode 100644 .gitpod/drupal/drupalpod-setup/git_setup.sh diff --git a/.gitpod.yml b/.gitpod.yml index a6b6080c..34577873 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,7 +9,6 @@ tasks: .gitpod/utils/send-a-message-gcs.sh > /tmp/output1.txt .gitpod/utils/ddev-in-gitpod-setup.sh .gitpod/utils/set-base-environment.sh - time ddev start command: | # Temporary fix for wrong value of GITPOD_REPO_ROOT when opening a Gitpod snapshot # Todo: remove this when this issue is resolved - https://github.com/gitpod-io/gitpod/issues/9804 diff --git a/.gitpod/drupal/drupalpod-setup/cleanup.sh b/.gitpod/drupal/drupalpod-setup/cleanup.sh new file mode 100644 index 00000000..c9546351 --- /dev/null +++ b/.gitpod/drupal/drupalpod-setup/cleanup.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -eu -o pipefail + +# Remove site that was installed before (for debugging) +rm -rf "${GITPOD_REPO_ROOT}"/web +rm -rf "${GITPOD_REPO_ROOT}"/vendor +rm -f "${GITPOD_REPO_ROOT}"/composer.json +rm -f "${GITPOD_REPO_ROOT}"/composer.lock diff --git a/.gitpod/drupal/drupalpod-setup/ddev_setup.sh b/.gitpod/drupal/drupalpod-setup/ddev_setup.sh new file mode 100644 index 00000000..2353bc4c --- /dev/null +++ b/.gitpod/drupal/drupalpod-setup/ddev_setup.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -eu -o pipefail + +# set PHP version, based on https://www.drupal.org/docs/getting-started/system-requirements/php-requirements#versions +major_version=$(echo $DP_CORE_VERSION | cut -d '.' -f 1) +minor_version=$(echo $DP_CORE_VERSION | cut -d '.' -f 2) + +# Before Drupal 10.2, we should use php 8.2, otherwise use php 8.3 +if (( major_version < 10 )) || { (( major_version == 10 )) && (( minor_version < 2 )); }; then + php_version="8.2" +else + php_version="8.3" +fi + +cat < "${GITPOD_REPO_ROOT}"/.ddev/config.gitpod.yaml +#ddev-gitpod-generated +php_version: "$php_version" +CONFIGEND + +time ddev start diff --git a/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh b/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh deleted file mode 100644 index 7dc2b779..00000000 --- a/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -# Adding support for composer-drupal-lenient - https://packagist.org/packages/mglaman/composer-drupal-lenient -if [[ "$DP_CORE_VERSION" =~ ^10(\..*)?$ ]]; then - if [ "$DP_PROJECT_TYPE" != "project_core" ]; then - export COMPOSER_DRUPAL_LENIENT=mglaman/composer-drupal-lenient - else - export COMPOSER_DRUPAL_LENIENT='' - fi -fi - -# Adding support for composer-drupal-lenient - https://packagist.org/packages/mglaman/composer-drupal-lenient -if [[ "$DP_CORE_VERSION" =~ ^11(\..*)?$ ]]; then - # admin_toolbar and devel are not compatible yet with Drupal 11 - export DP_EXTRA_ADMIN_TOOLBAR= - export DP_EXTRA_DEVEL= - if [ "$DP_PROJECT_TYPE" != "project_core" ]; then - export COMPOSER_DRUPAL_LENIENT=mglaman/composer-drupal-lenient - else - export COMPOSER_DRUPAL_LENIENT='' - fi -fi diff --git a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh index 95a32e77..0c5b0f98 100755 --- a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh +++ b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh @@ -46,100 +46,26 @@ convert_version() { # echo $(convert_version "10.1.0-beta1") # Output: 10.1.x # echo $(convert_version "11.0-dev") # Output: 11.x -# If this is an issue fork of Drupal core - set the drupal core version based on that issue fork -if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then - VERSION_FROM_GIT=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') - DP_CORE_VERSION=$(convert_version "$VERSION_FROM_GIT") - export DP_CORE_VERSION -fi - -time ddev start - -# Measure the time it takes to go through the script -script_start_time=$(date +%s) - -source "$DIR/setup_env.sh" -source "$DIR/install_modules.sh" -source "$DIR/drupal_version_specifics.sh" - # Skip setup if it already ran once and if no special setup is set by DrupalPod extension if [ ! -f "${GITPOD_REPO_ROOT}"/.drupalpod_initiated ] && [ -n "$DP_PROJECT_TYPE" ]; then + source "$DIR/git_setup.sh" - # Add git.drupal.org to known_hosts - if [ -z "$GITPOD_HEADLESS" ]; then - mkdir -p ~/.ssh - host=git.drupal.org - SSHKey=$(ssh-keyscan $host 2>/dev/null) - echo "$SSHKey" >>~/.ssh/known_hosts - fi - - # Ignore specific directories during Drupal core development - cp "${GITPOD_REPO_ROOT}"/.gitpod/drupal/templates/git-exclude.template "${GITPOD_REPO_ROOT}"/.git/info/exclude - # Get the required repo ready - if [ "$DP_PROJECT_TYPE" == "project_core" ]; then - # Find if requested core version is dev or stable - d="$DP_CORE_VERSION" - case $d in - *.x) - # If dev - use git checkout origin/* - checkout_type=origin - ;; - *) - # stable - use git checkout tags/* - checkout_type=tags - ;; - esac - - # Use origin or tags in git checkout command - cd "${GITPOD_REPO_ROOT}"/repos/drupal && - git fetch origin && - git fetch --all --tags && - git checkout "$checkout_type"/"$DP_CORE_VERSION" - - # Ignore specific directories during Drupal core development - cp "${GITPOD_REPO_ROOT}"/.gitpod/drupal/templates/git-exclude.template "${GITPOD_REPO_ROOT}"/repos/drupal/.git/info/exclude - else - # If not core - clone selected project into /repos and remove drupal core - rm -rf "${GITPOD_REPO_ROOT}"/repos/drupal - if [ ! -d repos/"${DP_PROJECT_NAME}" ]; then - mkdir -p repos - cd "${GITPOD_REPO_ROOT}"/repos && time git clone https://git.drupalcode.org/project/"$DP_PROJECT_NAME".git - fi + # If this is an issue fork of Drupal core - set the drupal core version based on that issue fork + if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then + VERSION_FROM_GIT=$(grep 'const VERSION' "${GITPOD_REPO_ROOT}"/repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') + DP_CORE_VERSION=$(convert_version "$VERSION_FROM_GIT") + export DP_CORE_VERSION fi - # Set WORK_DIR - export WORK_DIR="${GITPOD_REPO_ROOT}"/repos/$DP_PROJECT_NAME - - # Dynamically generate .gitmodules file - cat <"${GITPOD_REPO_ROOT}"/.gitmodules -# This file was dynamically generated by a script -[submodule "$DP_PROJECT_NAME"] - path = repos/$DP_PROJECT_NAME - url = https://git.drupalcode.org/project/$DP_PROJECT_NAME.git - ignore = dirty -GITMODULESEND - - # Checkout specific branch only if there's issue_branch - if [ -n "$DP_ISSUE_BRANCH" ]; then - # If branch already exist only run checkout, - if cd "${WORK_DIR}" && git show-ref -q --heads "$DP_ISSUE_BRANCH"; then - cd "${WORK_DIR}" && git checkout "$DP_ISSUE_BRANCH" - else - cd "${WORK_DIR}" && git remote add "$DP_ISSUE_FORK" https://git.drupalcode.org/issue/"$DP_ISSUE_FORK".git - cd "${WORK_DIR}" && git fetch "$DP_ISSUE_FORK" - cd "${WORK_DIR}" && git checkout -b "$DP_ISSUE_BRANCH" --track "$DP_ISSUE_FORK"/"$DP_ISSUE_BRANCH" - fi - elif [ -n "$DP_MODULE_VERSION" ] && [ "$DP_PROJECT_TYPE" != "project_core" ]; then - cd "${WORK_DIR}" && git checkout "$DP_MODULE_VERSION" - fi + source "$DIR/ddev_setup.sh" - # Remove site that was installed before (for debugging) - rm -rf "${GITPOD_REPO_ROOT}"/web - rm -rf "${GITPOD_REPO_ROOT}"/vendor - rm -f "${GITPOD_REPO_ROOT}"/composer.json - rm -f "${GITPOD_REPO_ROOT}"/composer.lock + # Measure the time it takes to go through the script + script_start_time=$(date +%s) + source "$DIR/fallback_setup.sh" + source "$DIR/install_modules.sh" + source "$DIR/cleanup.sh" source "$DIR/composer_setup.sh" if [ -n "$DP_PATCH_FILE" ]; then diff --git a/.gitpod/drupal/drupalpod-setup/setup_env.sh b/.gitpod/drupal/drupalpod-setup/fallback_setup.sh similarity index 100% rename from .gitpod/drupal/drupalpod-setup/setup_env.sh rename to .gitpod/drupal/drupalpod-setup/fallback_setup.sh diff --git a/.gitpod/drupal/drupalpod-setup/git_setup.sh b/.gitpod/drupal/drupalpod-setup/git_setup.sh new file mode 100644 index 00000000..3ec3947c --- /dev/null +++ b/.gitpod/drupal/drupalpod-setup/git_setup.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +set -eu -o pipefail + +# Add git.drupal.org to known_hosts +if [ -z "$GITPOD_HEADLESS" ]; then + mkdir -p ~/.ssh + host=git.drupal.org + SSHKey=$(ssh-keyscan $host 2>/dev/null) + echo "$SSHKey" >>~/.ssh/known_hosts +fi + +# Ignore specific directories during Drupal core development +cp "${GITPOD_REPO_ROOT}"/.gitpod/drupal/templates/git-exclude.template "${GITPOD_REPO_ROOT}"/.git/info/exclude + +# Get the required repo ready +if [ "$DP_PROJECT_TYPE" == "project_core" ]; then + # Find if requested core version is dev or stable + d="$DP_CORE_VERSION" + case $d in + *.x) + # If dev - use git checkout origin/* + checkout_type=origin + ;; + *) + # stable - use git checkout tags/* + checkout_type=tags + ;; + esac + + # Use origin or tags in git checkout command + cd "${GITPOD_REPO_ROOT}"/repos/drupal && + git fetch origin && + git fetch --all --tags && + git checkout "$checkout_type"/"$DP_CORE_VERSION" + + # Ignore specific directories during Drupal core development + cp "${GITPOD_REPO_ROOT}"/.gitpod/drupal/templates/git-exclude.template "${GITPOD_REPO_ROOT}"/repos/drupal/.git/info/exclude +else + # If not core - clone selected project into /repos and remove drupal core + rm -rf "${GITPOD_REPO_ROOT}"/repos/drupal + if [ ! -d repos/"${DP_PROJECT_NAME}" ]; then + mkdir -p repos + cd "${GITPOD_REPO_ROOT}"/repos && time git clone https://git.drupalcode.org/project/"$DP_PROJECT_NAME".git + fi +fi + +# Set WORK_DIR +export WORK_DIR="${GITPOD_REPO_ROOT}"/repos/$DP_PROJECT_NAME + +# Dynamically generate .gitmodules file +cat <"${GITPOD_REPO_ROOT}"/.gitmodules +# This file was dynamically generated by a script +[submodule "$DP_PROJECT_NAME"] +path = repos/$DP_PROJECT_NAME +url = https://git.drupalcode.org/project/$DP_PROJECT_NAME.git +ignore = dirty +GITMODULESEND + +# Checkout specific branch only if there's issue_branch +if [ -n "$DP_ISSUE_BRANCH" ]; then + # If branch already exist only run checkout, + if cd "${WORK_DIR}" && git show-ref -q --heads "$DP_ISSUE_BRANCH"; then + cd "${WORK_DIR}" && git checkout "$DP_ISSUE_BRANCH" + else + cd "${WORK_DIR}" && git remote add "$DP_ISSUE_FORK" https://git.drupalcode.org/issue/"$DP_ISSUE_FORK".git + cd "${WORK_DIR}" && git fetch "$DP_ISSUE_FORK" + cd "${WORK_DIR}" && git checkout -b "$DP_ISSUE_BRANCH" --track "$DP_ISSUE_FORK"/"$DP_ISSUE_BRANCH" + fi +elif [ -n "$DP_MODULE_VERSION" ] && [ "$DP_PROJECT_TYPE" != "project_core" ]; then + cd "${WORK_DIR}" && git checkout "$DP_MODULE_VERSION" +fi diff --git a/.gitpod/drupal/drupalpod-setup/install_modules.sh b/.gitpod/drupal/drupalpod-setup/install_modules.sh index 0dde4cf5..0398ee63 100644 --- a/.gitpod/drupal/drupalpod-setup/install_modules.sh +++ b/.gitpod/drupal/drupalpod-setup/install_modules.sh @@ -10,3 +10,24 @@ export ADMIN_TOOLBAR_PACKAGE="drupal/admin_toolbar" # TODO: once Drupalpod extension supports additional modules - remove these 2 lines export DP_EXTRA_DEVEL=1 export DP_EXTRA_ADMIN_TOOLBAR=1 + +# Adding support for composer-drupal-lenient - https://packagist.org/packages/mglaman/composer-drupal-lenient +if [[ "$DP_CORE_VERSION" =~ ^10(\..*)?$ ]]; then + if [ "$DP_PROJECT_TYPE" != "project_core" ]; then + export COMPOSER_DRUPAL_LENIENT=mglaman/composer-drupal-lenient + else + export COMPOSER_DRUPAL_LENIENT='' + fi +fi + +# Adding support for composer-drupal-lenient - https://packagist.org/packages/mglaman/composer-drupal-lenient +if [[ "$DP_CORE_VERSION" =~ ^11(\..*)?$ ]]; then + # admin_toolbar and devel are not compatible yet with Drupal 11 + export DP_EXTRA_ADMIN_TOOLBAR= + export DP_EXTRA_DEVEL= + if [ "$DP_PROJECT_TYPE" != "project_core" ]; then + export COMPOSER_DRUPAL_LENIENT=mglaman/composer-drupal-lenient + else + export COMPOSER_DRUPAL_LENIENT='' + fi +fi diff --git a/.gitpod/utils/ddev-in-gitpod-setup.sh b/.gitpod/utils/ddev-in-gitpod-setup.sh index 2bd08c86..c03dfe6f 100755 --- a/.gitpod/utils/ddev-in-gitpod-setup.sh +++ b/.gitpod/utils/ddev-in-gitpod-setup.sh @@ -3,28 +3,5 @@ if [ -n "$DEBUG_SCRIPT" ] || [ -n "$GITPOD_HEADLESS" ]; then set -x fi -# If this is an issue fork of Drupal core - set the drupal core version based on that issue fork -if [ "$DP_PROJECT_TYPE" == "project_core" ] && [ -n "$DP_ISSUE_FORK" ]; then - DRUPAL_CORE_VERSION=$(grep 'const VERSION' repos/drupal/core/lib/Drupal.php | awk -F "'" '{print $2}') -else - DRUPAL_CORE_VERSION=$DP_CORE_VERSION -fi - -# set PHP version, based on https://www.drupal.org/docs/getting-started/system-requirements/php-requirements#versions -major_version=$(echo $DRUPAL_CORE_VERSION | cut -d '.' -f 1) -minor_version=$(echo $DRUPAL_CORE_VERSION | cut -d '.' -f 2) - -# Before Drupal 10.2, we should use php 8.2, otherwise use php 8.3 -if (( major_version < 10 )) || { (( major_version == 10 )) && (( minor_version < 2 )); }; then - php_version="8.2" -else - php_version="8.3" -fi - -cat < .ddev/config.gitpod.yaml -#ddev-gitpod-generated -php_version: "$php_version" -CONFIGEND - # Misc housekeeping before start ddev config global --instrumentation-opt-in=true From 90e06256e97dfdbd25e77c9d961f45a1a70a2ccd Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Sun, 21 Apr 2024 18:46:41 +0000 Subject: [PATCH 11/12] Revert "fix: temp debug" This reverts commit ff6f14e5b14fd32dcd27f74066b47c51e0bbe702. --- .gitpod.yml | 2 -- .gitpod/drupal/drupalpod-setup/drupalpod-setup.sh | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 34577873..9f40943d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,8 +4,6 @@ image: drupalpod/drupalpod-gitpod-base:20240419 # when starting a workspace all docker images are ready tasks: - init: | - printenv | grep DP_ - echo gitpod-yml !!! .gitpod/utils/send-a-message-gcs.sh > /tmp/output1.txt .gitpod/utils/ddev-in-gitpod-setup.sh .gitpod/utils/set-base-environment.sh diff --git a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh index 0c5b0f98..3aececbd 100755 --- a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh +++ b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -eu -o -x pipefail +set -eu -o pipefail # Initialize all variables with null if they do not exist : "${DEBUG_SCRIPT:=}" @@ -19,9 +19,6 @@ set -eu -o -x pipefail : "${DP_MODULE_VERSION:=}" : "${DP_PATCH_FILE:=}" -echo after!!! -printenv | grep DP - # Assuming .sh files are in the same directory as this script DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" From 49992f7fd1ba051ecf5798bdc33e40abfa9f5cef Mon Sep 17 00:00:00 2001 From: Ofer Shaal Date: Sun, 21 Apr 2024 16:45:21 -0400 Subject: [PATCH 12/12] Update .gitpod/drupal/drupalpod-setup/ddev_setup.sh Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .gitpod/drupal/drupalpod-setup/ddev_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitpod/drupal/drupalpod-setup/ddev_setup.sh b/.gitpod/drupal/drupalpod-setup/ddev_setup.sh index 2353bc4c..691a98c1 100644 --- a/.gitpod/drupal/drupalpod-setup/ddev_setup.sh +++ b/.gitpod/drupal/drupalpod-setup/ddev_setup.sh @@ -2,8 +2,8 @@ set -eu -o pipefail # set PHP version, based on https://www.drupal.org/docs/getting-started/system-requirements/php-requirements#versions -major_version=$(echo $DP_CORE_VERSION | cut -d '.' -f 1) -minor_version=$(echo $DP_CORE_VERSION | cut -d '.' -f 2) +major_version=$(echo "$DP_CORE_VERSION" | cut -d '.' -f 1) +minor_version=$(echo "$DP_CORE_VERSION" | cut -d '.' -f 2) # Before Drupal 10.2, we should use php 8.2, otherwise use php 8.3 if (( major_version < 10 )) || { (( major_version == 10 )) && (( minor_version < 2 )); }; then