Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support drupal 11 #146

Merged
merged 12 commits into from
Apr 22, 2024
Merged

fix: support drupal 11 #146

merged 12 commits into from
Apr 22, 2024

Conversation

shaal
Copy link
Owner

@shaal shaal commented Apr 19, 2024

Fix #144, #145

In this PR:

  • Update to the latest ddev (1.23.0)
  • Support Drupal 11
  • Prioritize core version based on issue branches (as opposed to the version the user choose / appear on issue page)

Summary by CodeRabbit

  • New Features

    • Updated the development environment base image to enhance performance and compatibility.
    • Introduced new versions of development tools including GitUI, LazyGit, and Minio client.
    • Added a new script for cleaning up site files and Composer-related files for debugging.
    • Enhanced the setup process to dynamically select PHP versions based on the Drupal core version.
    • Added support for the composer-drupal-lenient package to improve module compatibility with Drupal 11.
  • Bug Fixes

    • Adjusted environment setup scripts to handle version specifics and ensure global accessibility of certain variables.
  • Chores

    • Streamlined Git environment setup for Drupal projects to enhance developer workflow efficiency.

@shaal shaal self-assigned this Apr 19, 2024
Copy link

codesandbox bot commented Apr 19, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

coderabbitai bot commented Apr 19, 2024

Walkthrough

The updates primarily focus on enhancing compatibility with Drupal 11, including upgrading the development environment, adding new scripts, and updating existing configurations. Key changes include PHP version adjustments based on Drupal core versions, inclusion of tools like DDEV, and a general update of utilities to support the latest technologies.

Changes

File Path Change Summary
.gitpod.yml Updated base image and added new init commands.
.gitpod/images/Dockerfile Added DDEV setup, updated GitUI, LazyGit, and Minio client versions.
.gitpod/.../drupalpod-setup/... Added new scripts and functions for version handling, setup, and cleanup.
.gitpod/utils/ddev-in-gitpod-setup.sh Dynamically sets PHP version based on Drupal core, updates flags.

Assessment against linked issues

Objective Addressed Explanation
Compatibility with Drupal 11 (#144)
Update development environment for Drupal 11 (#144)

🐇🎉
In fields of code, where logic plays,
A rabbit hopped through the Drupal maze.
With whiskers twitched, and eyes a-spark,
New paths carved out from dawn till dark.
"Hop, hop, hurray!" the updates sing,
A leap towards future, in digital spring. 🌼
🐇🎉


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 90e0625 and 49992f7.
Files selected for processing (1)
  • .gitpod/drupal/drupalpod-setup/ddev_setup.sh (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .gitpod/drupal/drupalpod-setup/ddev_setup.sh

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Actionable comments outside the diff hunks (1)
.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh (1)

Line range hint 186-186: Correct the syntax issue with the then keyword.

Ensure that there is a semicolon or a linefeed before the then keyword to avoid syntax errors in the script. This will ensure the script executes as expected without interruptions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Comment on lines +11 to +20
# 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using sudo in Dockerfiles to enhance security.

Using sudo in Dockerfiles can lead to potential security vulnerabilities and configuration errors. Consider running these commands as a non-root user or ensuring that the user context is appropriately managed without sudo.

.gitpod/images/Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@mradcliffe mradcliffe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the code base is checked out to the core version prior to setting php_version so DrupalPod never gets the correct php_version for core.


# 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The php_version seems to always get set to 8.2 when I launch with https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=10.2.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/tree/issue/NT-Drupal11-update or https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=11.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/tree/issue/NT-Drupal11-update maybe because drupal core has not been checked out to DP_CORE_VERSION yet?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=11.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/tree/issue/NT-Drupal11-update should work.

I think that maybe then the condition on line 6 should check emptiness of DP_ISSUE_FORK.

Copy link
Contributor

@mradcliffe mradcliffe Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stand corrected, it still chose 8.2 rather than 8.3.

So I think we should not rely on the codebase checkout because it hasn't happened yet?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe if DP_CORE_VERSION does not match what is currently checked out, then ignore the current checkout for this script since it's an init script?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the Drupal 11 quickstart. If you ddev config --update it sets to php8.3. But it can obviously be done with --php-version

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfay thank you! I am trying to support multiple drupal versions in drupalpod, and I thought adding .ddev/config.gitpod.yaml based on what's needed is the easiest way, but I am open to change that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested Drupal core 11.x: https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=11.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/pull/146 - success

Tested freelinking 4.0.x using Drupal core 11.x: https://gitpod.io/#DP_PROJECT_NAME=freelinking,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_module,DP_MODULE_VERSION=4.0.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/drupalpod/pull/146 - success

I haven't done any manual regression testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drupal 10.2.x issue with issue fork branch: https://gitpod.io/new/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=drupal-3440560,DP_ISSUE_BRANCH=3440560-menu-is-created,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=10.2.x,DP_CORE_VERSION=10.2.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/drupalpod/pull/146 failed because composer tried to install 11.x, but couldn't, and it also chose php_version 8.3.


# 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested Drupal core 11.x: https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=11.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/pull/146 - success

Tested freelinking 4.0.x using Drupal core 11.x: https://gitpod.io/#DP_PROJECT_NAME=freelinking,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_module,DP_MODULE_VERSION=4.0.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/drupalpod/pull/146 - success

I haven't done any manual regression testing.

Copy link
Contributor

@mradcliffe mradcliffe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke too soon. Regression testing an issue fork branch on 10.2.x failed.


# 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drupal 10.2.x issue with issue fork branch: https://gitpod.io/new/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=drupal-3440560,DP_ISSUE_BRANCH=3440560-menu-is-created,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=10.2.x,DP_CORE_VERSION=10.2.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/drupalpod/pull/146 failed because composer tried to install 11.x, but couldn't, and it also chose php_version 8.3.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

.gitpod/drupal/drupalpod-setup/ddev_setup.sh Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@mradcliffe mradcliffe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the following scenarios successfully.

  • 10.2.x issue fork regression test: https://gitpod.io/new/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=drupal-3440560,DP_ISSUE_BRANCH=3440560-menu-is-created,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=10.2.x,DP_CORE_VERSION=10.2.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/drupalpod/pull/146
  • 10.1.x , php 8.2 regression test: https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=10.1.x,DP_CORE_VERSION=10.1.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/pull/146
  • 11.x core test: https://gitpod.io/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=11.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE='standard'/https://github.com/shaal/DrupalPod/pull/146
  • 11.x contrib test: https://gitpod.io/#DP_PROJECT_NAME=freelinking,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_module,DP_MODULE_VERSION=4.0.x,DP_CORE_VERSION=11.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/drupalpod/pull/146

@shaal
Copy link
Owner Author

shaal commented Apr 22, 2024

Thank you!

@shaal shaal merged commit e58c519 into main Apr 22, 2024
6 of 7 checks passed
shaal pushed a commit that referenced this pull request Sep 6, 2024
@shaal shaal deleted the issue/NT-Drupal11-update branch September 17, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants