From 0014db7534e4023e5206a90b3e2d81eaa0d8c364 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 13 May 2024 09:42:51 +1000 Subject: [PATCH 01/24] Moved linting of container images in CI to take place before stack build. --- .circleci/config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30ac3670f..eaf6bd620 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -238,6 +238,13 @@ jobs: - v1.21.0-db10-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}- #;> !PROVISION_USE_PROFILE + - run: + name: Lint Dockerfiles with Hadolint + command: | + for file in $(find . -name 'Dockerfile' -o -name '*.dockerfile'); do + echo "Linting ${file}" && cat "${file}" | docker run --rm -i hadolint/hadolint || [ "${DREVOPS_CI_HADOLINT_IGNORE_FAILURE:-0}" -eq 1 ] + done + - run: name: Login to container registry command: ./scripts/drevops/login-container-registry.sh @@ -259,13 +266,6 @@ jobs: if [ -n \"${GITHUB_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${GITHUB_TOKEN-}\"}}'; fi && \ COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist" - - run: - name: Lint Dockerfiles with Hadolint - command: | - for file in $(find . -name 'Dockerfile' -o -name '*.dockerfile'); do - echo "Linting ${file}" && cat "${file}" | docker run --rm -i hadolint/hadolint || [ "${DREVOPS_CI_HADOLINT_IGNORE_FAILURE:-0}" -eq 1 ] - done - - run: name: Lint code with PHPCS command: docker compose exec -T cli vendor/bin/phpcs || [ "${DREVOPS_CI_PHPCS_IGNORE_FAILURE:-0}" -eq 1 ] From 03c7dc31de0f850d6204872bbe3b2d380ee72297 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 13 May 2024 19:16:48 +1000 Subject: [PATCH 02/24] Added Composer config validation to CI. --- .circleci/config.yml | 4 ++++ .../docs/.utils/variables/extra/ci.variables.sh | 6 ++++++ .scaffold/docs/content/workflows/variables.mdx | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index eaf6bd620..4e0461dcb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -259,6 +259,10 @@ jobs: mkdir -p "${DREVOPS_EXPORT_CODE_DIR}" docker compose cp -L cli:"/app/." "${DREVOPS_EXPORT_CODE_DIR}" + - run: + name: Validate Composer configuration + command: docker compose exec cli composer validate --strict || [ "${DREVOPS_CI_COMPOSER_VALIDATE_IGNORE_FAILURE:-0}" -eq 1 ] + - run: name: Install development dependencies command: | diff --git a/.scaffold/docs/.utils/variables/extra/ci.variables.sh b/.scaffold/docs/.utils/variables/extra/ci.variables.sh index 2f9f72173..50156b943 100755 --- a/.scaffold/docs/.utils/variables/extra/ci.variables.sh +++ b/.scaffold/docs/.utils/variables/extra/ci.variables.sh @@ -9,6 +9,12 @@ DREVOPS_EXPORT_DB_CONTAINER_REGISTRY_DEPLOY_PROCEED= # Directory to store exported code. DREVOPS_EXPORT_CODE_DIR= +# Ignore Hadolint failures. +DREVOPS_CI_HADOLINT_IGNORE_FAILURE=0 + +# Ignore `composer validate` failures. +DREVOPS_CI_COMPOSER_VALIDATE_IGNORE_FAILURE=0 + # Ignore PHPCS failures. DREVOPS_CI_PHPCS_IGNORE_FAILURE=0 diff --git a/.scaffold/docs/content/workflows/variables.mdx b/.scaffold/docs/content/workflows/variables.mdx index d8a1472d0..6e257fdce 100644 --- a/.scaffold/docs/content/workflows/variables.mdx +++ b/.scaffold/docs/content/workflows/variables.mdx @@ -88,6 +88,22 @@ Default value: `UNDEFINED` Defined in: `CI config` +### `DREVOPS_CI_COMPOSER_VALIDATE_IGNORE_FAILURE` + +Ignore `composer validate` failures. + +Default value: `UNDEFINED` + +Defined in: `CI config` + +### `DREVOPS_CI_HADOLINT_IGNORE_FAILURE` + +Ignore Hadolint failures. + +Default value: `UNDEFINED` + +Defined in: `CI config` + ### `DREVOPS_CI_NPM_LINT_IGNORE_FAILURE` Ignore NPM linters failures. From 1f24419ad07b934de9c56f2edcdc6a80ed265da0 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 13 May 2024 19:21:35 +1000 Subject: [PATCH 03/24] Fixed Drupal file paths variables in `docker-compose.yml`. --- .scaffold/tests/bats/fixtures/docker-compose.env_mod.json | 4 ++-- docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json index f573e045c..262882d35 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json @@ -209,8 +209,8 @@ "build": { "args": { "CLI_IMAGE": "the_matrix", - "DRUPAL_PRIVATE_FILES": "/app/docroot/sites/default/files/private", - "DRUPAL_PUBLIC_FILES": "/app/docroot/sites/default/files", + "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", + "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_TEMPORARY_FILES": "/tmp", "WEBROOT": "docroot" }, diff --git a/docker-compose.yml b/docker-compose.yml index f6e9ab825..1b739e4d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -114,8 +114,8 @@ services: args: CLI_IMAGE: *cli-image WEBROOT: "${DREVOPS_WEBROOT:-web}" - DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/${DREVOPS_WEBROOT:-web}/sites/default/files} - DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/${DREVOPS_WEBROOT:-web}/sites/default/files/private} + DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files} + DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private} DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp} <<: [*default-volumes, *default-user] environment: From e13212639b6f0e3d37ffbf34731e77d2d7fdfa7d Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 14 May 2024 08:16:05 +1000 Subject: [PATCH 04/24] Fixed GHA to remove PR envs in Lagoon. --- .github/workflows/close-pull-request.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/close-pull-request.yml b/.github/workflows/close-pull-request.yml index 9a9fccda7..1fcfae00c 100644 --- a/.github/workflows/close-pull-request.yml +++ b/.github/workflows/close-pull-request.yml @@ -21,4 +21,6 @@ jobs: --header "X-GitHub-Delivery: ${RUNNER_TRACKING_ID:7}" \ --header "X-GitHub-Event: pull_request" \ --data-binary @- \ - "${LAGOON_WEBHOOK_ENDPOINT-https://hooks.lagoon.amazeeio.cloud/}" + "${LAGOON_WEBHOOK_ENDPOINT:-https://hooks.lagoon.amazeeio.cloud/}" + env: + LAGOON_WEBHOOK_ENDPOINT: ${{ env.LAGOON_WEBHOOK_ENDPOINT }} From f1c04678e9eb32a2265845c09f549a44e1f01f15 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 20 May 2024 09:39:58 +1000 Subject: [PATCH 05/24] Fixed coding standards. --- .../custom/ys_core/tests/src/Traits/ReflectionTrait.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/web/modules/custom/ys_core/tests/src/Traits/ReflectionTrait.php b/web/modules/custom/ys_core/tests/src/Traits/ReflectionTrait.php index a12bfa650..60bc531da 100644 --- a/web/modules/custom/ys_core/tests/src/Traits/ReflectionTrait.php +++ b/web/modules/custom/ys_core/tests/src/Traits/ReflectionTrait.php @@ -64,15 +64,8 @@ protected static function callProtectedMethod(object|string $object, string $nam /** * Set protected property value. - * - * @param object $object - * Object to set the value on. - * @param string $property - * Property name to set the value. Property should exists in the object. - * @param mixed $value - * Value to set to the property. */ - protected static function setProtectedValue($object, $property, mixed $value): void { + protected static function setProtectedValue(object $object, string $property, mixed $value): void { $class = new \ReflectionClass($object::class); $property = $class->getProperty($property); $property->setAccessible(TRUE); From 1e89c9b0149f99539c08019799bd749189b95abf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 11:48:39 +1000 Subject: [PATCH 06/24] Update Container images to v24.5.1 (#1326) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .docker/cli.dockerfile | 2 +- .docker/mariadb.dockerfile | 2 +- .docker/nginx-drupal.dockerfile | 2 +- .docker/php.dockerfile | 2 +- .docker/solr.dockerfile | 2 +- docker-compose.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index cfd19bdc0..da4d6663a 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -6,7 +6,7 @@ # # @see https://hub.docker.com/r/uselagoon/php-8.2-cli-drupal/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-cli-drupal -FROM uselagoon/php-8.2-cli-drupal:24.5.0 +FROM uselagoon/php-8.2-cli-drupal:24.5.1 # Add missing variables. # @todo Remove once https://github.com/uselagoon/lagoon/issues/3121 is resolved. diff --git a/.docker/mariadb.dockerfile b/.docker/mariadb.dockerfile index 75578497e..cfeee4f09 100644 --- a/.docker/mariadb.dockerfile +++ b/.docker/mariadb.dockerfile @@ -8,7 +8,7 @@ # @see https://github.com/drevops/mariadb-drupal-data # # The ARG value will be updated with a value passed from docker-compose.yml -ARG IMAGE=uselagoon/mariadb-10.11-drupal:24.5.0 +ARG IMAGE=uselagoon/mariadb-10.11-drupal:24.5.1 # hadolint ignore=DL3006 FROM ${IMAGE} diff --git a/.docker/nginx-drupal.dockerfile b/.docker/nginx-drupal.dockerfile index a28f26edb..dab5aca7e 100644 --- a/.docker/nginx-drupal.dockerfile +++ b/.docker/nginx-drupal.dockerfile @@ -9,7 +9,7 @@ FROM ${CLI_IMAGE:-cli} as cli # @see https://hub.docker.com/r/uselagoon/nginx-drupal/tags?page=1 # @see https://github.com/uselagoon/lagoon-images/tree/main/images/nginx-drupal -FROM uselagoon/nginx-drupal:24.5.0 +FROM uselagoon/nginx-drupal:24.5.1 # Webroot is used for Nginx docroot configuration. ARG WEBROOT=web diff --git a/.docker/php.dockerfile b/.docker/php.dockerfile index 6245659c0..407ceb1a5 100644 --- a/.docker/php.dockerfile +++ b/.docker/php.dockerfile @@ -10,7 +10,7 @@ FROM ${CLI_IMAGE:-cli} as cli # @see https://hub.docker.com/r/uselagoon/php-8.2-fpm/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-fpm -FROM uselagoon/php-8.2-fpm:24.5.0 +FROM uselagoon/php-8.2-fpm:24.5.1 RUN apk add --no-cache tzdata diff --git a/.docker/solr.dockerfile b/.docker/solr.dockerfile index 792d6fba4..b080afb13 100644 --- a/.docker/solr.dockerfile +++ b/.docker/solr.dockerfile @@ -5,7 +5,7 @@ FROM ${CLI_IMAGE} as cli # @see https://hub.docker.com/r/uselagoon/solr-8/tags # @see https://github.com/uselagoon/lagoon-images/blob/main/images/solr/8.Dockerfile -FROM uselagoon/solr-8:24.5.0 +FROM uselagoon/solr-8:24.5.1 # Solr Jump-start config needs to be manually copied from search_api_solr module # /app/docroot/modules/contrib/search_api_solr/jump-start/solr8/config-set. diff --git a/docker-compose.yml b/docker-compose.yml index 1b739e4d0..fc46236f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -158,7 +158,7 @@ services: context: . dockerfile: .docker/mariadb.dockerfile args: - IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.5.0}" # Use custom database image (if defined) or fallback to standard database image. + IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.5.1}" # Use custom database image (if defined) or fallback to standard database image. <<: *default-user environment: <<: *default-environment @@ -171,7 +171,7 @@ services: #;< REDIS redis: - image: uselagoon/redis-6:24.5.0 + image: uselagoon/redis-6:24.5.1 #;< LAGOON labels: lagoon.type: redis # Change to 'none' if dedicated Redis service is used. See https://docs.lagoon.sh/using-lagoon-advanced/service-types/ From efb33084fb57e761d70386aa2e1cbbe8e885c7b4 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 3 Jun 2024 17:32:10 +1000 Subject: [PATCH 07/24] Removed test for creating labels. --- .scaffold/tests/bats/workflow.utilities.bats | 72 -------------------- 1 file changed, 72 deletions(-) diff --git a/.scaffold/tests/bats/workflow.utilities.bats b/.scaffold/tests/bats/workflow.utilities.bats index c770732c3..ed929e012 100644 --- a/.scaffold/tests/bats/workflow.utilities.bats +++ b/.scaffold/tests/bats/workflow.utilities.bats @@ -59,78 +59,6 @@ load _helper.workflow.bash assert_output_contains "Ahoy" } -@test "GitHub labels" { - prepare_sut "Starting utilities tests in build directory ${BUILD_DIR}" - - step "Run ahoy github-labels" - - export GITHUB_TOKEN="${TEST_GITHUB_TOKEN}" - - # Use "drevops/scaffold-destination" as an example GitHub project. - run ahoy github-labels drevops/scaffold-destination - assert_success - assert_output_not_contains "ERROR" - - run curl https://github.com/drevops/scaffold-destination/labels - assert_success - - assert_output_contains ">BLOCKED<" - assert_output_contains "Issue or pull request is blocked" - assert_output_contains ">PR: AUTOMERGE<" - assert_output_contains "Pull request has been approved and set to automerge" - assert_output_contains ">PR: CONFLICT<" - assert_output_contains "Pull request has a conflict that needs to be resolved before it can be merged" - assert_output_contains ">PR: Dependencies<" - assert_output_contains "Pull request was raised automatically by a dependency bot" - assert_output_contains ">PR: DO NOT MERGE<" - assert_output_contains "Do not merge this pull request" - assert_output_contains ">PR: Do not review<" - assert_output_contains "Do not review this pull request" - assert_output_contains ">PR: Needs review<" - assert_output_contains "Pull request needs a review from assigned developers" - assert_output_contains ">PR: Ready for test<" - assert_output_contains "Pull request is ready for manual testing" - assert_output_contains ">PR: Ready to be merged<" - assert_output_contains "Pull request is ready to be merged (assigned after testing is complete)" - assert_output_contains ">PR: Requires more work<" - assert_output_contains "Pull request was reviewed and reviver(s) asked to work further on the pull request" - assert_output_contains ">PR: URGENT<" - assert_output_contains "Pull request needs to be urgently reviewed" - assert_output_contains ">State: Confirmed<" - assert_output_contains "The issue was triaged and confirmed for development" - assert_output_contains ">State: Done<" - assert_output_contains "The issue is complete and waiting for a release" - assert_output_contains ">State: In progress<" - assert_output_contains "The issue is being worked on" - assert_output_contains ">State: Needs more info<" - assert_output_contains "The issue requires more information" - assert_output_contains ">State: Needs more work<" - assert_output_contains "The issue requires more work" - assert_output_contains ">State: Needs triage<" - assert_output_contains "An issue or PR has not been assessed and requires a triage" - assert_output_contains ">State: QA<" - assert_output_contains "The issue is in QA" - assert_output_contains ">Type: Chore<" - assert_output_contains "Issue is a related to a maintenance" - assert_output_contains ">Type: Defect<" - assert_output_contains "Issue is a defect" - assert_output_contains ">Type: Feature<" - assert_output_contains "Issue is a new feature request" - assert_output_contains ">Type: Question<" - assert_output_contains "Issue is a question" - assert_output_contains ">UPSTREAM<" - assert_output_contains "Issue or pull request is related to an upstream project" - - assert_output_not_contains ">bug<" - assert_output_not_contains ">duplicate<" - assert_output_not_contains ">enhancement<" - assert_output_not_contains ">help wanted<" - assert_output_not_contains ">good first issue<" - assert_output_not_contains ">invalid<" - assert_output_not_contains ">question<" - assert_output_not_contains ">wontfix<" -} - @test "Renovate - Check config" { prepare_sut "Starting utilities tests in build directory ${BUILD_DIR}" From 0121bbff2e5f5458dafcd9ac17d78118e60685e5 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Tue, 4 Jun 2024 12:01:15 +0700 Subject: [PATCH 08/24] [#1328] Added support for custom configuration location via `DRUPAL_CONFIG_PATH`. --- .docker/cli.dockerfile | 7 ++++-- .../bats/fixtures/docker-compose.env.json | 8 +++++++ .../fixtures/docker-compose.env_local.json | 8 +++++++ .../bats/fixtures/docker-compose.env_mod.json | 8 +++++++ .../bats/fixtures/docker-compose.noenv.json | 8 +++++++ docker-compose.yml | 3 +++ .../Drupal/EnvironmentSettingsTest.php | 22 +++++++++---------- tests/phpunit/Drupal/SettingsTestCase.php | 6 +++++ web/sites/default/settings.php | 2 +- 9 files changed, 58 insertions(+), 14 deletions(-) diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index da4d6663a..5c252b4f4 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -30,6 +30,9 @@ ENV DRUPAL_PRIVATE_FILES=${DRUPAL_PRIVATE_FILES} ARG DRUPAL_TEMPORARY_FILES="${TMP:-/tmp}" ENV DRUPAL_TEMPORARY_FILES=${DRUPAL_TEMPORARY_FILES} +ARG DRUPAL_CONFIG_PATH="/app/config/default" +ENV DRUPAL_CONFIG_PATH=${DRUPAL_CONFIG_PATH} + # Set default values for environment variables. # These values will be overridden if set in docker-compose.yml or .env file # during build stage. @@ -95,8 +98,8 @@ RUN npm --prefix /app/${WEBROOT}/themes/custom/your_site_theme ci --no-audit --n COPY . /app # Create files directories and set correct permissions. -RUN mkdir -p "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" && \ - chmod 0770 "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" +RUN mkdir -p "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" "${DRUPAL_CONFIG_PATH}" && \ + chmod 0770 "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" "${DRUPAL_CONFIG_PATH}" # Compile front-end assets. Running this after copying all files as we need # sources to compile assets. diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env.json b/.scaffold/tests/bats/fixtures/docker-compose.env.json index 44b66c3bc..f22922e4b 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env.json @@ -24,6 +24,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -70,6 +71,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -118,6 +120,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -173,6 +176,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -209,6 +213,7 @@ "build": { "args": { "CLI_IMAGE": "star_wars", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_TEMPORARY_FILES": "/tmp", @@ -228,6 +233,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -290,6 +296,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -362,6 +369,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_local.json b/.scaffold/tests/bats/fixtures/docker-compose.env_local.json index 44b66c3bc..f22922e4b 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_local.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_local.json @@ -24,6 +24,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -70,6 +71,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -118,6 +120,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -173,6 +176,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -209,6 +213,7 @@ "build": { "args": { "CLI_IMAGE": "star_wars", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_TEMPORARY_FILES": "/tmp", @@ -228,6 +233,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -290,6 +296,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", @@ -362,6 +369,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "0", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json index 262882d35..b9dd25ee0 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json @@ -24,6 +24,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", @@ -70,6 +71,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", @@ -118,6 +120,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", @@ -173,6 +176,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", @@ -209,6 +213,7 @@ "build": { "args": { "CLI_IMAGE": "the_matrix", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_TEMPORARY_FILES": "/tmp", @@ -228,6 +233,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", @@ -290,6 +296,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", @@ -362,6 +369,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "1", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.noenv.json b/.scaffold/tests/bats/fixtures/docker-compose.noenv.json index 74016b8f5..f974d07e0 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.noenv.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.noenv.json @@ -24,6 +24,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", @@ -70,6 +71,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", @@ -118,6 +120,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", @@ -173,6 +176,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", @@ -209,6 +213,7 @@ "build": { "args": { "CLI_IMAGE": "star_wars", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_TEMPORARY_FILES": "/tmp", @@ -228,6 +233,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", @@ -290,6 +296,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", @@ -362,6 +369,7 @@ "environment": { "CI": "true", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", + "DRUPAL_CONFIG_PATH": "/app/config/default", "DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private", "DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files", "DRUPAL_REDIS_ENABLED": "", diff --git a/docker-compose.yml b/docker-compose.yml index fc46236f0..161e95049 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -62,6 +62,8 @@ x-environment: &default-environment CI: ${CI:-} # Forward emails to Mailhog locally. SSMTP_MAILHUB: ${SSMTP_MAILHUB:-host.docker.internal:1025} + # Path to configuration files. + DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-/app/config/default} # Drupal file paths. DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files} DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private} @@ -114,6 +116,7 @@ services: args: CLI_IMAGE: *cli-image WEBROOT: "${DREVOPS_WEBROOT:-web}" + DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-/app/config/default} DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files} DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private} DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp} diff --git a/tests/phpunit/Drupal/EnvironmentSettingsTest.php b/tests/phpunit/Drupal/EnvironmentSettingsTest.php index fddf41dea..bbc6d0568 100644 --- a/tests/phpunit/Drupal/EnvironmentSettingsTest.php +++ b/tests/phpunit/Drupal/EnvironmentSettingsTest.php @@ -254,7 +254,7 @@ public function testEnvironmentGeneric(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_SUT; @@ -298,7 +298,7 @@ public function testEnvironmentLocal(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_LOCAL; @@ -342,7 +342,7 @@ public function testEnvironmentCi(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_CI; @@ -389,7 +389,7 @@ public function testEnvironmentAcquiaDynamic(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_DEV; @@ -430,7 +430,7 @@ public function testEnvironmentAcquiaDev(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_DEV; @@ -471,7 +471,7 @@ public function testEnvironmentAcquiaTest(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_TEST; @@ -510,7 +510,7 @@ public function testEnvironmentAcquiaProd(): void { $this->assertConfig($config); $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_PROD; @@ -557,7 +557,7 @@ public function testEnvironmentLagoonDynamic(): void { $settings['cache_prefix']['default'] = 'test_project_test_branch'; $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_DEV; @@ -608,7 +608,7 @@ public function testEnvironmentLagoonDev(): void { $settings['cache_prefix']['default'] = 'test_project_develop'; $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_DEV; @@ -659,7 +659,7 @@ public function testEnvironmentLagoonTest(): void { $settings['cache_prefix']['default'] = 'test_project_master'; $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_TEST; @@ -709,7 +709,7 @@ public function testEnvironmentLagoonProd(): void { $settings['cache_prefix']['default'] = 'test_project_production'; $settings['config_exclude_modules'] = []; - $settings['config_sync_directory'] = '../config/default'; + $settings['config_sync_directory'] = static::CONFIG_PATH_TESTING; $settings['container_yamls'][0] = $this->app_root . '/' . $this->site_path . '/services.yml'; $settings['entity_update_batch_size'] = 50; $settings['environment'] = static::ENVIRONMENT_PROD; diff --git a/tests/phpunit/Drupal/SettingsTestCase.php b/tests/phpunit/Drupal/SettingsTestCase.php index 41b5ae065..e9cda0cb6 100644 --- a/tests/phpunit/Drupal/SettingsTestCase.php +++ b/tests/phpunit/Drupal/SettingsTestCase.php @@ -59,6 +59,11 @@ abstract class SettingsTestCase extends TestCase { */ final const PRIVATE_PATH_TESTING = '/private-test'; + /** + * Defines a constant for the config directory used in testing. + */ + final const CONFIG_PATH_TESTING = '/config-test'; + /** * Application root. * @@ -127,6 +132,7 @@ protected function setEnvVars(array $vars): void { $vars['LAGOON'] = FALSE; } + $vars['DRUPAL_CONFIG_PATH'] = static::CONFIG_PATH_TESTING; $vars['DRUPAL_TEMPORARY_FILES'] = static::TMP_PATH_TESTING; $vars['DRUPAL_PRIVATE_FILES'] = static::PRIVATE_PATH_TESTING; diff --git a/web/sites/default/settings.php b/web/sites/default/settings.php index 8cf777a48..fa62d6cd4 100644 --- a/web/sites/default/settings.php +++ b/web/sites/default/settings.php @@ -58,7 +58,7 @@ $settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml'; // Location of the site configuration files. -$settings['config_sync_directory'] = '../config/default'; +$settings['config_sync_directory'] = getenv('DRUPAL_CONFIG_PATH') ?: '../config/default'; // Private directory. $settings['file_private_path'] = getenv('DRUPAL_PRIVATE_FILES') ?: 'sites/default/files/private'; From 0853cb9e170089c2cc115ef844bce1c8421c1986 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 6 Jun 2024 11:39:35 +1000 Subject: [PATCH 09/24] Normalized `composer.json`. --- composer.json | 90 ++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/composer.json b/composer.json index 75daae8de..6baa46d6d 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,8 @@ { "name": "your_org/your_site", "description": "Drupal 10 implementation of YOURSITE for YOURORG", - "type": "project", "license": "proprietary", - "repositories": [ - { - "type": "composer", - "url": "https://packages.drupal.org/8" - }, - { - "type": "composer", - "url": "https://asset-packagist.org" - } - ], + "type": "project", "require": { "php": ">=8.2", "composer/installers": "^2.2", @@ -45,6 +35,7 @@ "drevops/behat-steps": "^2.3", "drupal/core-dev": "^10.2", "drupal/drupal-extension": "^5", + "ergebnis/composer-normalize": "^2.42", "mglaman/phpstan-drupal": "^1.2", "palantirnet/drupal-rector": "^0.20", "phpcompatibility/php-compatibility": "^9.3", @@ -57,65 +48,63 @@ "conflict": { "drupal/drupal": "*" }, + "repositories": [ + { + "type": "composer", + "url": "https://packages.drupal.org/8" + }, + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ], "minimum-stability": "stable", "prefer-stable": true, + "autoload": { + "classmap": [ + "scripts/composer/ScriptHandler.php" + ] + }, + "autoload-dev": { + "classmap": [ + "tests/phpunit/" + ] + }, "config": { - "discard-changes": true, - "sort-packages": true, "allow-plugins": { "composer/installers": true, "cweagans/composer-patches": true, "dealerdirect/phpcodesniffer-composer-installer": true, "drupal/core-composer-scaffold": true, + "ergebnis/composer-normalize": true, "oomphinc/composer-installers-extender": true, "php-http/discovery": true, "phpstan/extension-installer": true, "pyrech/composer-changelogs": true }, + "discard-changes": true, "platform": { "php": "8.2.18" - } - }, - "autoload": { - "classmap": [ - "scripts/composer/ScriptHandler.php" - ] - }, - "autoload-dev": { - "classmap": [ - "tests/phpunit/" - ] - }, - "scripts": { - "pre-install-cmd": [ - "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" - ], - "pre-update-cmd": [ - "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" - ], - "post-install-cmd": [ - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" - ], - "post-update-cmd": [ - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" - ] + }, + "sort-packages": true }, "extra": { + "composer-exit-on-patch-failure": true, "drupal-scaffold": { - "locations": { - "web-root": "web/" - }, "file-mapping": { "[project-root]/.editorconfig": false, "[project-root]/.gitattributes": false, - "[web-root]/.htaccess": false, "[web-root]/.ht.router.php": false, - "[web-root]/example.gitignore": false, + "[web-root]/.htaccess": false, "[web-root]/INSTALL.txt": false, "[web-root]/README.txt": false, + "[web-root]/example.gitignore": false, "[web-root]/sites/example.settings.local.php": false, "[web-root]/sites/example.sites.php": false, "[web-root]/web.config": false + }, + "locations": { + "web-root": "web/" } }, "installer-paths": { @@ -151,10 +140,23 @@ "npm-asset", "drupal-library" ], - "composer-exit-on-patch-failure": true, "patchLevel": { "drupal/core": "-p2" }, "patches": {} + }, + "scripts": { + "pre-install-cmd": [ + "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" + ], + "post-install-cmd": [ + "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" + ], + "pre-update-cmd": [ + "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" + ], + "post-update-cmd": [ + "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" + ] } } From 28a273182f60aa0f59dcdf453268ba7c40af4c26 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 6 Jun 2024 11:44:17 +1000 Subject: [PATCH 10/24] Updated `composer.json` to include the latest configs from `drupal-project`. --- composer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6baa46d6d..e27f327c4 100644 --- a/composer.json +++ b/composer.json @@ -112,8 +112,8 @@ "type:drupal-core" ], "web/libraries/{$name}": [ - "type:drupal-library", "type:bower-asset", + "type:drupal-library", "type:npm-asset" ], "web/modules/contrib/{$name}": [ @@ -129,9 +129,14 @@ "type:drupal-drush" ], "web/modules/custom/{$name}": [ + "type:drupal-custom-module", "type:drupal-custom-module" ], + "web/profiles/custom/{$name}": [ + "type:drupal-custom-profile" + ], "web/themes/custom/{$name}": [ + "type:drupal-custom-theme", "type:drupal-custom-theme" ] }, From 134ec6056b3e0387f2cbc85fa0111060f995ac7f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:09:41 +0000 Subject: [PATCH 11/24] Update Container images to v24.6.0 --- .docker/cli.dockerfile | 2 +- .docker/mariadb.dockerfile | 2 +- .docker/nginx-drupal.dockerfile | 2 +- .docker/php.dockerfile | 2 +- .docker/solr.dockerfile | 2 +- docker-compose.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index 5c252b4f4..6f245fa89 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -6,7 +6,7 @@ # # @see https://hub.docker.com/r/uselagoon/php-8.2-cli-drupal/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-cli-drupal -FROM uselagoon/php-8.2-cli-drupal:24.5.1 +FROM uselagoon/php-8.2-cli-drupal:24.6.0 # Add missing variables. # @todo Remove once https://github.com/uselagoon/lagoon/issues/3121 is resolved. diff --git a/.docker/mariadb.dockerfile b/.docker/mariadb.dockerfile index cfeee4f09..3c52dab1e 100644 --- a/.docker/mariadb.dockerfile +++ b/.docker/mariadb.dockerfile @@ -8,7 +8,7 @@ # @see https://github.com/drevops/mariadb-drupal-data # # The ARG value will be updated with a value passed from docker-compose.yml -ARG IMAGE=uselagoon/mariadb-10.11-drupal:24.5.1 +ARG IMAGE=uselagoon/mariadb-10.11-drupal:24.6.0 # hadolint ignore=DL3006 FROM ${IMAGE} diff --git a/.docker/nginx-drupal.dockerfile b/.docker/nginx-drupal.dockerfile index dab5aca7e..5ef02def5 100644 --- a/.docker/nginx-drupal.dockerfile +++ b/.docker/nginx-drupal.dockerfile @@ -9,7 +9,7 @@ FROM ${CLI_IMAGE:-cli} as cli # @see https://hub.docker.com/r/uselagoon/nginx-drupal/tags?page=1 # @see https://github.com/uselagoon/lagoon-images/tree/main/images/nginx-drupal -FROM uselagoon/nginx-drupal:24.5.1 +FROM uselagoon/nginx-drupal:24.6.0 # Webroot is used for Nginx docroot configuration. ARG WEBROOT=web diff --git a/.docker/php.dockerfile b/.docker/php.dockerfile index 407ceb1a5..c623ba45d 100644 --- a/.docker/php.dockerfile +++ b/.docker/php.dockerfile @@ -10,7 +10,7 @@ FROM ${CLI_IMAGE:-cli} as cli # @see https://hub.docker.com/r/uselagoon/php-8.2-fpm/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-fpm -FROM uselagoon/php-8.2-fpm:24.5.1 +FROM uselagoon/php-8.2-fpm:24.6.0 RUN apk add --no-cache tzdata diff --git a/.docker/solr.dockerfile b/.docker/solr.dockerfile index b080afb13..6302b0923 100644 --- a/.docker/solr.dockerfile +++ b/.docker/solr.dockerfile @@ -5,7 +5,7 @@ FROM ${CLI_IMAGE} as cli # @see https://hub.docker.com/r/uselagoon/solr-8/tags # @see https://github.com/uselagoon/lagoon-images/blob/main/images/solr/8.Dockerfile -FROM uselagoon/solr-8:24.5.1 +FROM uselagoon/solr-8:24.6.0 # Solr Jump-start config needs to be manually copied from search_api_solr module # /app/docroot/modules/contrib/search_api_solr/jump-start/solr8/config-set. diff --git a/docker-compose.yml b/docker-compose.yml index 161e95049..76eca864e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -161,7 +161,7 @@ services: context: . dockerfile: .docker/mariadb.dockerfile args: - IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.5.1}" # Use custom database image (if defined) or fallback to standard database image. + IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.6.0}" # Use custom database image (if defined) or fallback to standard database image. <<: *default-user environment: <<: *default-environment @@ -174,7 +174,7 @@ services: #;< REDIS redis: - image: uselagoon/redis-6:24.5.1 + image: uselagoon/redis-6:24.6.0 #;< LAGOON labels: lagoon.type: redis # Change to 'none' if dedicated Redis service is used. See https://docs.lagoon.sh/using-lagoon-advanced/service-types/ From 83f48bdbd68513a4b441220bc304c2112a6263ff Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 18 Jun 2024 17:28:19 +1000 Subject: [PATCH 12/24] Updated coding standards in tests. --- tests/phpunit/CircleCiConfigTest.php | 4 ++-- tests/phpunit/Drupal/DatabaseSettingsTest.php | 2 +- tests/phpunit/Drupal/SwitchableSettingsTest.php | 8 ++++---- .../custom/ys_core/tests/src/Kernel/ExampleTest.php | 6 +++--- web/modules/custom/ys_core/tests/src/Unit/ExampleTest.php | 6 +++--- .../your_site_theme/tests/src/Kernel/ExampleTest.php | 6 +++--- .../custom/your_site_theme/tests/src/Unit/ExampleTest.php | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/phpunit/CircleCiConfigTest.php b/tests/phpunit/CircleCiConfigTest.php index 41c5717f3..e1839c3f5 100644 --- a/tests/phpunit/CircleCiConfigTest.php +++ b/tests/phpunit/CircleCiConfigTest.php @@ -52,7 +52,7 @@ public function testDeployBranchRegex(string $branch, bool $expected = TRUE): vo /** * Data provider for testDeployBranchRegex(). */ - public function dataProviderDeployBranchRegex(): array { + public static function dataProviderDeployBranchRegex(): array { return [ // Positive branches. ['main'], @@ -191,7 +191,7 @@ public function testDeployTagRegex(string $branch, bool $expected = TRUE): void /** * Data provider for testDeployTagRegex(). */ - public function dataProviderDeployTagRegex(): array { + public static function dataProviderDeployTagRegex(): array { return [ // Positive tags. ['1.2.3'], diff --git a/tests/phpunit/Drupal/DatabaseSettingsTest.php b/tests/phpunit/Drupal/DatabaseSettingsTest.php index f70864117..843ae196f 100644 --- a/tests/phpunit/Drupal/DatabaseSettingsTest.php +++ b/tests/phpunit/Drupal/DatabaseSettingsTest.php @@ -29,7 +29,7 @@ public function testDatabases(array $vars, array $expected): void { /** * Data provider for resulting database settings. */ - public function dataProviderDatabases(): array { + public static function dataProviderDatabases(): array { return [ [ [], diff --git a/tests/phpunit/Drupal/SwitchableSettingsTest.php b/tests/phpunit/Drupal/SwitchableSettingsTest.php index d5d469d05..0170ec44a 100644 --- a/tests/phpunit/Drupal/SwitchableSettingsTest.php +++ b/tests/phpunit/Drupal/SwitchableSettingsTest.php @@ -92,7 +92,7 @@ public function testConfigSplit(string $env, array $expected_present, array $exp /** * Data provider for testConfigSplit(). */ - public function dataProviderConfigSplit(): array { + public static function dataProviderConfigSplit(): array { return [ [ static::ENVIRONMENT_LOCAL, @@ -180,7 +180,7 @@ public function testEnvironmentIndicator(string $env, array $expected_present, a /** * Data provider for testEntityPrint(). */ - public function dataProviderEnvironmentIndicator(): array { + public static function dataProviderEnvironmentIndicator(): array { return [ [ static::ENVIRONMENT_LOCAL, @@ -292,7 +292,7 @@ public function testShield(string $env, array $vars, array $expected_present, ar /** * Data provider for testShield(). */ - public function dataProviderShield(): array { + public static function dataProviderShield(): array { return [ [ static::ENVIRONMENT_LOCAL, @@ -410,7 +410,7 @@ public function testStageFileProxy(string $env, array $vars, array $expected_pre /** * Data provider for testStageFileProxy(). */ - public function dataProviderStageFileProxy(): array { + public static function dataProviderStageFileProxy(): array { return [ [ static::ENVIRONMENT_LOCAL, diff --git a/web/modules/custom/ys_core/tests/src/Kernel/ExampleTest.php b/web/modules/custom/ys_core/tests/src/Kernel/ExampleTest.php index 04f4df22a..5585090ec 100644 --- a/web/modules/custom/ys_core/tests/src/Kernel/ExampleTest.php +++ b/web/modules/custom/ys_core/tests/src/Kernel/ExampleTest.php @@ -36,7 +36,7 @@ public function testAdd(int $a, int $b, int $expected, string|null $expectExcept /** * Data provider for testAdd(). */ - public function dataProviderAdd(): array { + public static function dataProviderAdd(): array { return [ [0, 0, 0], [1, 1, 2], @@ -64,7 +64,7 @@ public function testSubtract(int $a, int $b, int $expected, string|null $expectE /** * Data provider for testSubtract(). */ - public function dataProviderSubtract(): array { + public static function dataProviderSubtract(): array { return [ [0, 0, 0], [1, 1, 0], @@ -94,7 +94,7 @@ public function testMultiplication(int $a, int $b, int $expected, string|null $e /** * Data provider for testMultiplication(). */ - public function dataProviderMultiplication(): array { + public static function dataProviderMultiplication(): array { return [ [0, 0, 0], [1, 1, 1], diff --git a/web/modules/custom/ys_core/tests/src/Unit/ExampleTest.php b/web/modules/custom/ys_core/tests/src/Unit/ExampleTest.php index ea13844df..fbcc09965 100644 --- a/web/modules/custom/ys_core/tests/src/Unit/ExampleTest.php +++ b/web/modules/custom/ys_core/tests/src/Unit/ExampleTest.php @@ -36,7 +36,7 @@ public function testAdd(int $a, int $b, int $expected, string|null $expectExcept /** * Data provider for testAdd(). */ - public function dataProviderAdd(): array { + public static function dataProviderAdd(): array { return [ [0, 0, 0], [1, 1, 2], @@ -64,7 +64,7 @@ public function testSubtract(int $a, int $b, int $expected, string|null $expectE /** * Data provider for testSubtract(). */ - public function dataProviderSubtract(): array { + public static function dataProviderSubtract(): array { return [ [0, 0, 0], [1, 1, 0], @@ -94,7 +94,7 @@ public function testMultiplication(int $a, int $b, int $expected, string|null $e /** * Data provider for testMultiplication(). */ - public function dataProviderMultiplication(): array { + public static function dataProviderMultiplication(): array { return [ [0, 0, 0], [1, 1, 1], diff --git a/web/themes/custom/your_site_theme/tests/src/Kernel/ExampleTest.php b/web/themes/custom/your_site_theme/tests/src/Kernel/ExampleTest.php index 644b139f7..d135ce801 100644 --- a/web/themes/custom/your_site_theme/tests/src/Kernel/ExampleTest.php +++ b/web/themes/custom/your_site_theme/tests/src/Kernel/ExampleTest.php @@ -36,7 +36,7 @@ public function testAdd(int $a, int $b, int $expected, string|null $expectExcept /** * Data provider for testAdd(). */ - public function dataProviderAdd(): array { + public static function dataProviderAdd(): array { return [ [0, 0, 0], [1, 1, 2], @@ -65,7 +65,7 @@ public function testSubtract(int $a, int $b, int $expected, string|null $expectE /** * Data provider for testSubtract(). */ - public function dataProviderSubtract(): array { + public static function dataProviderSubtract(): array { return [ [0, 0, 0], [1, 1, 0], @@ -96,7 +96,7 @@ public function testMultiplication(int $a, int $b, int $expected, string|null $e /** * Data provider for testMultiplication(). */ - public function dataProviderMultiplication(): array { + public static function dataProviderMultiplication(): array { return [ [0, 0, 0], [1, 1, 1], diff --git a/web/themes/custom/your_site_theme/tests/src/Unit/ExampleTest.php b/web/themes/custom/your_site_theme/tests/src/Unit/ExampleTest.php index 914a7d759..523901d0f 100644 --- a/web/themes/custom/your_site_theme/tests/src/Unit/ExampleTest.php +++ b/web/themes/custom/your_site_theme/tests/src/Unit/ExampleTest.php @@ -36,7 +36,7 @@ public function testAdd(int $a, int $b, int $expected, string|null $expectExcept /** * Data provider for testAdd(). */ - public function dataProviderAdd(): array { + public static function dataProviderAdd(): array { return [ [0, 0, 0], [1, 1, 2], @@ -65,7 +65,7 @@ public function testSubtract(int $a, int $b, int $expected, string|null $expectE /** * Data provider for testSubtract(). */ - public function dataProviderSubtract(): array { + public static function dataProviderSubtract(): array { return [ [0, 0, 0], [1, 1, 0], @@ -96,7 +96,7 @@ public function testMultiplication(int $a, int $b, int $expected, string|null $e /** * Data provider for testMultiplication(). */ - public function dataProviderMultiplication(): array { + public static function dataProviderMultiplication(): array { return [ [0, 0, 0], [1, 1, 1], From f9cbae71c93a603c9d9809595187d207f1c8e61b Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 18 Jun 2024 17:28:45 +1000 Subject: [PATCH 13/24] Updated `search_api` to the latest stable version. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e27f327c4..c4576275e 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "drupal/pathauto": "^1.12", "drupal/redirect": "^1.9", "drupal/redis": "^1.7", - "drupal/search_api": "^1.34", + "drupal/search_api": "^1.35", "drupal/search_api_solr": "^4.3", "drupal/shield": "^1.7", "drupal/stage_file_proxy": "^2.1", From 9c795b43c63b713c04c830795b6ee08d1030f6f8 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 18 Jun 2024 17:30:55 +1000 Subject: [PATCH 14/24] Updated Drupal core to 10.3 and set stability to `beta`. --- composer.json | 8 +++---- web/sites/default/default.services.yml | 9 +++++++ web/sites/default/default.settings.php | 33 ++++++++++++++++---------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index c4576275e..4d2f5c231 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,8 @@ "drupal/coffee": "^1.4", "drupal/config_split": "^1.9", "drupal/config_update": "^2@alpha", - "drupal/core-composer-scaffold": "^10.2", - "drupal/core-recommended": "^10.2", + "drupal/core-composer-scaffold": "^10.3", + "drupal/core-recommended": "^10.3", "drupal/environment_indicator": "^4.0", "drupal/pathauto": "^1.12", "drupal/redirect": "^1.9", @@ -33,7 +33,7 @@ "drevops/behat-format-progress-fail": "^1.2", "drevops/behat-screenshot": "^1.5", "drevops/behat-steps": "^2.3", - "drupal/core-dev": "^10.2", + "drupal/core-dev": "^10.3", "drupal/drupal-extension": "^5", "ergebnis/composer-normalize": "^2.42", "mglaman/phpstan-drupal": "^1.2", @@ -58,7 +58,7 @@ "url": "https://asset-packagist.org" } ], - "minimum-stability": "stable", + "minimum-stability": "beta", "prefer-stable": true, "autoload": { "classmap": [ diff --git a/web/sites/default/default.services.yml b/web/sites/default/default.services.yml index c4b964fc2..dacb3f7e9 100644 --- a/web/sites/default/default.services.yml +++ b/web/sites/default/default.services.yml @@ -1,4 +1,8 @@ parameters: + # Toggles the super user access policy. If your website has at least one user + # with the Administrator role, it is advised to set this to false. This allows + # you to make user 1 a regular user, strengthening the security of your site. + security.enable_super_user: true session.storage.options: # Default ini options for sessions. # @@ -60,6 +64,11 @@ parameters: # \Drupal\Core\Session\SessionConfiguration::__construct() # @default 6 sid_bits_per_character: 6 + # By default, Drupal generates a session cookie name based on the full + # domain name. Set the name_suffix to a short random string to ensure this + # session cookie name is unique on different installations on the same + # domain and path (for example, when migrating from Drupal 7). + name_suffix: '' twig.config: # Twig debugging: # diff --git a/web/sites/default/default.settings.php b/web/sites/default/default.settings.php index 8819d6431..264597b16 100644 --- a/web/sites/default/default.settings.php +++ b/web/sites/default/default.settings.php @@ -77,7 +77,7 @@ * * @code * $databases['default']['default'] = [ - * 'database' => 'databasename', + * 'database' => 'database_name', * 'username' => 'sql_username', * 'password' => 'sql_password', * 'host' => 'localhost', @@ -193,7 +193,7 @@ * @code * $databases['default']['default'] = [ * 'driver' => 'pgsql', - * 'database' => 'databasename', + * 'database' => 'database_name', * 'username' => 'sql_username', * 'password' => 'sql_password', * 'host' => 'localhost', @@ -215,7 +215,7 @@ * 'driver' => 'my_driver', * 'namespace' => 'Drupal\my_module\Driver\Database\my_driver', * 'autoload' => 'modules/my_module/src/Driver/Database/my_driver/', - * 'database' => 'databasename', + * 'database' => 'database_name', * 'username' => 'sql_username', * 'password' => 'sql_password', * 'host' => 'localhost', @@ -230,7 +230,7 @@ * 'driver' => 'my_driver', * 'namespace' => 'Drupal\my_module\Driver\Database\my_driver', * 'autoload' => 'modules/my_module/src/Driver/Database/my_driver/', - * 'database' => 'databasename', + * 'database' => 'database_name', * 'username' => 'sql_username', * 'password' => 'sql_password', * 'host' => 'localhost', @@ -355,14 +355,13 @@ * security, or encryption benefits. In an environment where Drupal * is behind a reverse proxy, the real IP address of the client should * be determined such that the correct client IP address is available - * to Drupal's logging, statistics, and access management systems. In - * the most simple scenario, the proxy server will add an - * X-Forwarded-For header to the request that contains the client IP - * address. However, HTTP headers are vulnerable to spoofing, where a - * malicious client could bypass restrictions by setting the - * X-Forwarded-For header directly. Therefore, Drupal's proxy - * configuration requires the IP addresses of all remote proxies to be - * specified in $settings['reverse_proxy_addresses'] to work correctly. + * to Drupal's logging and access management systems. In the most simple + * scenario, the proxy server will add an X-Forwarded-For header to the request + * that contains the client IP address. However, HTTP headers are vulnerable to + * spoofing, where a malicious client could bypass restrictions by setting the + * X-Forwarded-For header directly. Therefore, Drupal's proxy configuration + * requires the IP addresses of all remote proxies to be specified in + * $settings['reverse_proxy_addresses'] to work correctly. * * Enable this setting to get Drupal to determine the client IP from the * X-Forwarded-For header. If you are unsure about this setting, do not have a @@ -808,6 +807,16 @@ */ $settings['entity_update_backup'] = TRUE; +/** + * State caching. + * + * State caching uses the cache collector pattern to cache all requested keys + * from the state API in a single cache entry, which can greatly reduce the + * amount of database queries. However, some sites may use state with a + * lot of dynamic keys which could result in a very large cache. + */ +$settings['state_cache'] = TRUE; + /** * Node migration type. * From 3874a8ca1e53fa5da9898bbaee969ed146abcc44 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Tue, 18 Jun 2024 19:08:33 +0700 Subject: [PATCH 15/24] Updated to Drush 13 and fixed test. --- composer.json | 2 +- tests/phpunit/CircleCiConfigTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 4d2f5c231..6acc6dbff 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "drupal/search_api_solr": "^4.3", "drupal/shield": "^1.7", "drupal/stage_file_proxy": "^2.1", - "drush/drush": "^12.5", + "drush/drush": "^13", "oomphinc/composer-installers-extender": "^2.0", "vlucas/phpdotenv": "^5.6", "webflo/drupal-finder": "^1.2" diff --git a/tests/phpunit/CircleCiConfigTest.php b/tests/phpunit/CircleCiConfigTest.php index e1839c3f5..2fa0ff0e3 100644 --- a/tests/phpunit/CircleCiConfigTest.php +++ b/tests/phpunit/CircleCiConfigTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Drupal\Core\Serialization\Yaml; +use Drupal\Component\Serialization\Yaml; use PHPUnit\Framework\TestCase; /** From cacf5c16b7e28f2d48a1bfdc03847a1c760dfe82 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:59:01 +0000 Subject: [PATCH 16/24] Update toshimaru/auto-author-assign action to v2.1.1 --- .github/workflows/assign-author.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign-author.yml b/.github/workflows/assign-author.yml index 466655fc9..a5e7fe1e0 100644 --- a/.github/workflows/assign-author.yml +++ b/.github/workflows/assign-author.yml @@ -15,4 +15,4 @@ jobs: steps: - name: Assign author - uses: toshimaru/auto-author-assign@v2.1.0 + uses: toshimaru/auto-author-assign@v2.1.1 From 0a54ee1188234538f7576ccf57044ab5bd5cb395 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:10:39 +0000 Subject: [PATCH 17/24] Update Container images to v24.7.0 --- .docker/cli.dockerfile | 2 +- .docker/mariadb.dockerfile | 2 +- .docker/nginx-drupal.dockerfile | 2 +- .docker/php.dockerfile | 2 +- .docker/solr.dockerfile | 2 +- docker-compose.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index 6f245fa89..f7f20c1d8 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -6,7 +6,7 @@ # # @see https://hub.docker.com/r/uselagoon/php-8.2-cli-drupal/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-cli-drupal -FROM uselagoon/php-8.2-cli-drupal:24.6.0 +FROM uselagoon/php-8.2-cli-drupal:24.7.0 # Add missing variables. # @todo Remove once https://github.com/uselagoon/lagoon/issues/3121 is resolved. diff --git a/.docker/mariadb.dockerfile b/.docker/mariadb.dockerfile index 3c52dab1e..eea823a81 100644 --- a/.docker/mariadb.dockerfile +++ b/.docker/mariadb.dockerfile @@ -8,7 +8,7 @@ # @see https://github.com/drevops/mariadb-drupal-data # # The ARG value will be updated with a value passed from docker-compose.yml -ARG IMAGE=uselagoon/mariadb-10.11-drupal:24.6.0 +ARG IMAGE=uselagoon/mariadb-10.11-drupal:24.7.0 # hadolint ignore=DL3006 FROM ${IMAGE} diff --git a/.docker/nginx-drupal.dockerfile b/.docker/nginx-drupal.dockerfile index 5ef02def5..df678e460 100644 --- a/.docker/nginx-drupal.dockerfile +++ b/.docker/nginx-drupal.dockerfile @@ -9,7 +9,7 @@ FROM ${CLI_IMAGE:-cli} as cli # @see https://hub.docker.com/r/uselagoon/nginx-drupal/tags?page=1 # @see https://github.com/uselagoon/lagoon-images/tree/main/images/nginx-drupal -FROM uselagoon/nginx-drupal:24.6.0 +FROM uselagoon/nginx-drupal:24.7.0 # Webroot is used for Nginx docroot configuration. ARG WEBROOT=web diff --git a/.docker/php.dockerfile b/.docker/php.dockerfile index c623ba45d..31c49aa99 100644 --- a/.docker/php.dockerfile +++ b/.docker/php.dockerfile @@ -10,7 +10,7 @@ FROM ${CLI_IMAGE:-cli} as cli # @see https://hub.docker.com/r/uselagoon/php-8.2-fpm/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-fpm -FROM uselagoon/php-8.2-fpm:24.6.0 +FROM uselagoon/php-8.2-fpm:24.7.0 RUN apk add --no-cache tzdata diff --git a/.docker/solr.dockerfile b/.docker/solr.dockerfile index 6302b0923..7b303ed6f 100644 --- a/.docker/solr.dockerfile +++ b/.docker/solr.dockerfile @@ -5,7 +5,7 @@ FROM ${CLI_IMAGE} as cli # @see https://hub.docker.com/r/uselagoon/solr-8/tags # @see https://github.com/uselagoon/lagoon-images/blob/main/images/solr/8.Dockerfile -FROM uselagoon/solr-8:24.6.0 +FROM uselagoon/solr-8:24.7.0 # Solr Jump-start config needs to be manually copied from search_api_solr module # /app/docroot/modules/contrib/search_api_solr/jump-start/solr8/config-set. diff --git a/docker-compose.yml b/docker-compose.yml index 76eca864e..2399d414b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -161,7 +161,7 @@ services: context: . dockerfile: .docker/mariadb.dockerfile args: - IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.6.0}" # Use custom database image (if defined) or fallback to standard database image. + IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.7.0}" # Use custom database image (if defined) or fallback to standard database image. <<: *default-user environment: <<: *default-environment @@ -174,7 +174,7 @@ services: #;< REDIS redis: - image: uselagoon/redis-6:24.6.0 + image: uselagoon/redis-6:24.7.0 #;< LAGOON labels: lagoon.type: redis # Change to 'none' if dedicated Redis service is used. See https://docs.lagoon.sh/using-lagoon-advanced/service-types/ From af9ffe4d46c83aca26140d1fea4fd6e28bd91cbf Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 07:09:49 +1000 Subject: [PATCH 18/24] Fixed GitHub notification not handling longer deployment IDs. --- .scaffold/tests/bats/notify.bats | 2 +- scripts/drevops/notify-github.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.scaffold/tests/bats/notify.bats b/.scaffold/tests/bats/notify.bats index 6b94013f5..4efd6d084 100644 --- a/.scaffold/tests/bats/notify.bats +++ b/.scaffold/tests/bats/notify.bats @@ -148,7 +148,7 @@ load _helper.bash declare -a STEPS=( "Started dispatching notifications." "Started GitHub notification for post_deployment event." - "@curl -X GET -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments?ref=mybranch # [{\"id\": \"${app_id}\", \"othervar\": \"54321\"},{\"id\": \"987654321\", \"othervar\": \"12345\"}]" + "@curl -X GET -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments?ref=mybranch # [{\"id\": \"${app_id}\", \"othervar\": \"54321\"},{\"id\": \"98765432101\", \"othervar\": \"12345\"}]" "@curl -X POST -H Accept: application/vnd.github.v3+json -H Authorization: token token12345 https://api.github.com/repos/myorg/myrepo/deployments/123456789/statuses -s -d {\"state\":\"success\", \"environment_url\": \"https://develop.testproject.com\"} # {\"state\": \"success\", \"othervar\": \"54321\"}" "Marked deployment as finished." "Finished GitHub notification for post_deployment event." diff --git a/scripts/drevops/notify-github.sh b/scripts/drevops/notify-github.sh index bbbe3b15d..24f55b259 100755 --- a/scripts/drevops/notify-github.sh +++ b/scripts/drevops/notify-github.sh @@ -84,7 +84,7 @@ if [ "${DREVOPS_NOTIFY_EVENT}" = "pre_deployment" ]; then deployment_id="$(echo "${payload}" | extract_json_value "id")" # Check deployment ID. - { [ "${#deployment_id}" != "9" ] || [ "$(expr "x${deployment_id}" : "x[0-9]*$")" -eq 0 ]; } && fail "Unable to get a deployment ID." && exit 1 + { [ "${#deployment_id}" -lt 9 ] || [ "${#deployment_id}" -gt 11 ] || [ "$(expr "x${deployment_id}" : "x[0-9]*$")" -eq 0 ]; } && fail "Failed to get a deployment ID for a started operation. Payload: ${payload}" && exit 1 note "Marked deployment as started." else @@ -101,7 +101,7 @@ else deployment_id="$(echo "${payload}" | extract_json_first_value "id")" # Check deployment ID. - { [ "${#deployment_id}" != "9" ] || [ "$(expr "x${deployment_id}" : "x[0-9]*$")" -eq 0 ]; } && fail "Unable to get a deployment ID." && exit 1 + { [ "${#deployment_id}" -lt 9 ] || [ "${#deployment_id}" -gt 11 ] || [ "$(expr "x${deployment_id}" : "x[0-9]*$")" -eq 0 ]; } && fail "Failed to get a deployment ID for a finished operation. Payload: ${payload}" && exit 1 # Post status update. payload="$(curl \ From a53562c3b47dc99d3b20ed0fa71ecd8fe0eca5f9 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 07:00:22 +1000 Subject: [PATCH 19/24] Updated to PHP 8.3. --- .docker/cli.dockerfile | 4 ++-- .docker/php.dockerfile | 4 ++-- composer.json | 4 ++-- phpcs.xml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index f7f20c1d8..b6822ae5e 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -4,9 +4,9 @@ # # hadolint global ignore=DL3018 # -# @see https://hub.docker.com/r/uselagoon/php-8.2-cli-drupal/tags +# @see https://hub.docker.com/r/uselagoon/php-8.3-cli-drupal/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-cli-drupal -FROM uselagoon/php-8.2-cli-drupal:24.7.0 +FROM uselagoon/php-8.3-cli-drupal:24.7.0 # Add missing variables. # @todo Remove once https://github.com/uselagoon/lagoon/issues/3121 is resolved. diff --git a/.docker/php.dockerfile b/.docker/php.dockerfile index 31c49aa99..b34316044 100644 --- a/.docker/php.dockerfile +++ b/.docker/php.dockerfile @@ -8,9 +8,9 @@ ARG CLI_IMAGE # hadolint ignore=DL3006 FROM ${CLI_IMAGE:-cli} as cli -# @see https://hub.docker.com/r/uselagoon/php-8.2-fpm/tags +# @see https://hub.docker.com/r/uselagoon/php-8.3-fpm/tags # @see https://github.com/uselagoon/lagoon-images/tree/main/images/php-fpm -FROM uselagoon/php-8.2-fpm:24.7.0 +FROM uselagoon/php-8.3-fpm:24.7.0 RUN apk add --no-cache tzdata diff --git a/composer.json b/composer.json index 6acc6dbff..28abc7684 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "proprietary", "type": "project", "require": { - "php": ">=8.2", + "php": ">=8.3", "composer/installers": "^2.2", "cweagans/composer-patches": "^1.7", "drupal/admin_toolbar": "^3.4", @@ -84,7 +84,7 @@ }, "discard-changes": true, "platform": { - "php": "8.2.18" + "php": "8.3.9" }, "sort-packages": true }, diff --git a/phpcs.xml b/phpcs.xml index 46847d7dc..d4989de17 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -20,7 +20,7 @@ - + circle\.yml From 887ffd3be380530529e6409e7e629b27f4a2b9ee Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 07:41:33 +1000 Subject: [PATCH 20/24] Updated `drevops/docker-wait-for-dependencies` to `24.7.0`. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2399d414b..fe6d3ea6f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -235,7 +235,7 @@ services: # Helper container to wait for services to become available. wait_dependencies: - image: drevops/docker-wait-for-dependencies:24.3.0 + image: drevops/docker-wait-for-dependencies:24.7.0 depends_on: - cli - mariadb From 441d96a64b7f5c14f8c5b076adecc6f0513067c0 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 06:51:14 +1000 Subject: [PATCH 21/24] Updated CI runner to `24.7.0`. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e0461dcb..ef5e31516 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,7 @@ aliases: # This container has all the necessary tools to run a dockerized environment. # @see https://github.com/drevops/ci-runner # @see https://hub.docker.com/repository/docker/drevops/ci-runner/tags?page=1&ordering=last_updated - - image: drevops/ci-runner:24.4.0 + - image: drevops/ci-runner:24.7.0 auth: username: ${DREVOPS_CONTAINER_REGISTRY_USER} password: ${DREVOPS_CONTAINER_REGISTRY_PASS} From 2f9fc4e7168adc2e6ba7a3f99552bc396c96c3b1 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 07:47:31 +1000 Subject: [PATCH 22/24] Switched to tilde constants for Drupal Core and Drush. --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 28abc7684..6f756c0f2 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,8 @@ "drupal/coffee": "^1.4", "drupal/config_split": "^1.9", "drupal/config_update": "^2@alpha", - "drupal/core-composer-scaffold": "^10.3", - "drupal/core-recommended": "^10.3", + "drupal/core-composer-scaffold": "~10.3.0", + "drupal/core-recommended": "~10.3.0", "drupal/environment_indicator": "^4.0", "drupal/pathauto": "^1.12", "drupal/redirect": "^1.9", @@ -22,7 +22,7 @@ "drupal/search_api_solr": "^4.3", "drupal/shield": "^1.7", "drupal/stage_file_proxy": "^2.1", - "drush/drush": "^13", + "drush/drush": "~13.0", "oomphinc/composer-installers-extender": "^2.0", "vlucas/phpdotenv": "^5.6", "webflo/drupal-finder": "^1.2" @@ -33,7 +33,7 @@ "drevops/behat-format-progress-fail": "^1.2", "drevops/behat-screenshot": "^1.5", "drevops/behat-steps": "^2.3", - "drupal/core-dev": "^10.3", + "drupal/core-dev": "~10.3.0", "drupal/drupal-extension": "^5", "ergebnis/composer-normalize": "^2.42", "mglaman/phpstan-drupal": "^1.2", From 4fb3264c1550595c4dabe92a4e445d70bf08f732 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 09:31:23 +1000 Subject: [PATCH 23/24] Updated Rector rules to use the latest Drupal Finder. --- rector.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rector.php b/rector.php index cbba12cfc..2d7cad968 100644 --- a/rector.php +++ b/rector.php @@ -12,16 +12,14 @@ declare(strict_types=1); -use DrupalFinder\DrupalFinder; +use DrupalFinder\DrupalFinderComposerRuntime; use DrupalRector\Set\Drupal10SetList; use DrupalRector\Set\Drupal8SetList; use DrupalRector\Set\Drupal9SetList; use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector; use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector; use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector; -use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; -use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector; use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector; @@ -30,8 +28,7 @@ use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; return static function (RectorConfig $rectorConfig): void { - $drupalFinder = new DrupalFinder(); - $drupalFinder->locateRoot(__DIR__); + $drupalFinder = new DrupalFinderComposerRuntime(); $drupalRoot = $drupalFinder->getDrupalRoot(); $rectorConfig->autoloadPaths([ @@ -69,13 +66,11 @@ $rectorConfig->skip([ // Rules added by Rector's rule sets. - ArraySpreadInsteadOfArrayMergeRector::class, CountArrayToEmptyArrayComparisonRector::class, DisallowedEmptyRuleFixerRector::class, InlineArrayReturnAssignRector::class, NewlineAfterStatementRector::class, NewlineBeforeNewAssignSetRector::class, - PostIncDecToPreIncDecRector::class, RemoveAlwaysTrueIfConditionRector::class, SimplifyEmptyCheckOnEmptyArrayRector::class, // Dependencies. From aff558593e98dfe2cf9a3e8eeb053ae89d91687f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 19 Jul 2024 08:47:47 +1000 Subject: [PATCH 24/24] Added missing `state_cache`. --- tests/phpunit/Drupal/EnvironmentSettingsTest.php | 12 +++++++++++- web/sites/default/default.settings.local.php | 3 +++ web/sites/default/settings.php | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/Drupal/EnvironmentSettingsTest.php b/tests/phpunit/Drupal/EnvironmentSettingsTest.php index bbc6d0568..271779723 100644 --- a/tests/phpunit/Drupal/EnvironmentSettingsTest.php +++ b/tests/phpunit/Drupal/EnvironmentSettingsTest.php @@ -269,6 +269,7 @@ public function testEnvironmentGeneric(): void { '^.+\.docker\.amazee\.io$', '^nginx$', ]; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -314,6 +315,7 @@ public function testEnvironmentLocal(): void { '^.+\.docker\.amazee\.io$', '^nginx$', ]; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -359,7 +361,7 @@ public function testEnvironmentCi(): void { '^.+\.docker\.amazee\.io$', '^nginx$', ]; - + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -402,6 +404,7 @@ public function testEnvironmentAcquiaDynamic(): void { $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -443,6 +446,7 @@ public function testEnvironmentAcquiaDev(): void { $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -484,6 +488,7 @@ public function testEnvironmentAcquiaTest(): void { $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -523,6 +528,7 @@ public function testEnvironmentAcquiaProd(): void { $settings['hash_salt'] = hash('sha256', getenv('MARIADB_HOST') ?: 'localhost'); $settings['trusted_host_patterns'][] = '^.+\.docker\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^nginx$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } // phpcs:ignore #;> ACQUIA @@ -575,6 +581,7 @@ public function testEnvironmentLagoonDynamic(): void { $settings['trusted_host_patterns'][] = '^nginx\-php$'; $settings['trusted_host_patterns'][] = '^.+\.au\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^example1\.com|example2/com$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -626,6 +633,7 @@ public function testEnvironmentLagoonDev(): void { $settings['trusted_host_patterns'][] = '^nginx\-php$'; $settings['trusted_host_patterns'][] = '^.+\.au\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^example1\.com|example2/com$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -677,6 +685,7 @@ public function testEnvironmentLagoonTest(): void { $settings['trusted_host_patterns'][] = '^nginx\-php$'; $settings['trusted_host_patterns'][] = '^.+\.au\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^example1\.com|example2/com$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } @@ -727,6 +736,7 @@ public function testEnvironmentLagoonProd(): void { $settings['trusted_host_patterns'][] = '^nginx\-php$'; $settings['trusted_host_patterns'][] = '^.+\.au\.amazee\.io$'; $settings['trusted_host_patterns'][] = '^example1\.com|example2/com$'; + $settings['state_cache'] = TRUE; $this->assertSettings($settings); } // phpcs:ignore #;> LAGOON diff --git a/web/sites/default/default.settings.local.php b/web/sites/default/default.settings.local.php index 41cbec563..85f6a6474 100644 --- a/web/sites/default/default.settings.local.php +++ b/web/sites/default/default.settings.local.php @@ -25,3 +25,6 @@ // Hide admin toolbar. Useful for themeing while logged in as admin. // $settings['hide_admin_toolbar'] = TRUE; + +// Disable state cache. +$settings['state_cache'] = FALSE; diff --git a/web/sites/default/settings.php b/web/sites/default/settings.php index fa62d6cd4..82e8b62c1 100644 --- a/web/sites/default/settings.php +++ b/web/sites/default/settings.php @@ -76,6 +76,9 @@ $config['system.performance']['css']['preprocess'] = TRUE; $config['system.performance']['js']['preprocess'] = TRUE; +// Enable state cache. +$settings['state_cache'] = TRUE; + // The default list of directories that will be ignored by Drupal's file API. $settings['file_scan_ignore_directories'] = [ 'node_modules',