diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 3ab0b38..b56b497 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -1,30 +1,32 @@ name: DrupalPod -type: drupal10 +type: drupal docroot: web -php_version: "8.1" +php_version: "8.3" webserver_type: nginx-fpm xdebug_enabled: false additional_hostnames: [] additional_fqdns: [] database: type: mariadb - version: "10.4" + version: "10.6" 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/.gitignore b/.gitignore index 23bd196..1b5d242 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.yml b/.gitpod.yml index 7709cb2..9f40943 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 @@ -7,7 +7,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 @@ -76,22 +75,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 diff --git a/.gitpod/README.md b/.gitpod/README.md index 5e779f8..658c01b 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/drupal/drupalpod-setup/cleanup.sh b/.gitpod/drupal/drupalpod-setup/cleanup.sh new file mode 100644 index 0000000..c954635 --- /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 0000000..691a98c --- /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_setup_core.sh b/.gitpod/drupal/drupalpod-setup/drupal_setup_core.sh index d3d1302..cea3118 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/drupal_version_specifics.sh b/.gitpod/drupal/drupalpod-setup/drupal_version_specifics.sh deleted file mode 100644 index 0991e45..0000000 --- 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 - DP_EXTRA_ADMIN_TOOLBAR= - 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 01122eb..3aececb 100755 --- a/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh +++ b/.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh @@ -26,93 +26,43 @@ if [ -n "$DEBUG_SCRIPT" ] || [ -n "$GITPOD_HEADLESS" ]; then set -x fi -time ddev start - -# Measure the time it takes to go through the script -script_start_time=$(date +%s) +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 +} -source "$DIR/setup_env.sh" -source "$DIR/install_modules.sh" -source "$DIR/drupal_version_specifics.sh" +# 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 # 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/fallback_setup.sh b/.gitpod/drupal/drupalpod-setup/fallback_setup.sh new file mode 100644 index 0000000..193cc3d --- /dev/null +++ b/.gitpod/drupal/drupalpod-setup/fallback_setup.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# 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 diff --git a/.gitpod/drupal/drupalpod-setup/git_setup.sh b/.gitpod/drupal/drupalpod-setup/git_setup.sh new file mode 100644 index 0000000..3ec3947 --- /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 0dde4cf..0398ee6 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/drupal/drupalpod-setup/setup_env.sh b/.gitpod/drupal/drupalpod-setup/setup_env.sh deleted file mode 100644 index 15cfb52..0000000 --- a/.gitpod/drupal/drupalpod-setup/setup_env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# Set the default setup during prebuild process -if [ -n "$GITPOD_HEADLESS" ]; 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/images/Dockerfile b/.gitpod/images/Dockerfile index d19764c..d52a90e 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_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/) # 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 diff --git a/.gitpod/utils/ddev-in-gitpod-setup.sh b/.gitpod/utils/ddev-in-gitpod-setup.sh index 3ec199f..c03dfe6 100755 --- a/.gitpod/utils/ddev-in-gitpod-setup.sh +++ b/.gitpod/utils/ddev-in-gitpod-setup.sh @@ -3,10 +3,5 @@ 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" -fi - # 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 0000000..85ac1cf --- /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'; + } + +}