Commit 76a33e41 authored by Jonathan Smith's avatar Jonathan Smith
Browse files

Issue #3325788 by jonathan1055: Fix Tugboat preview build

parent ad8bd31d
Loading
Loading
Loading
Loading
+45 −13
Original line number Diff line number Diff line
services:
  php:
    image: q0rban/tugboat-drupal:9.3
    # We can build at D9 or D10. This is determined by the image statement below
    # not the core version of the drupalci test that triggered the build.
    # image: q0rban/tugboat-drupal:9.5
    image: q0rban/tugboat-drupal:10.0
    default: true
    http: false
    depends: mysql
@@ -8,6 +11,9 @@ services:
      init: |
        # Install the bcmath extension, required for commerce_product
        docker-php-ext-install bcmath
        # JPEG support is not included by default, but it is needed when generating content.
        docker-php-ext-configure gd --enable-gd --with-jpeg
        docker-php-ext-install gd

      update: |
        set -eux
@@ -37,20 +43,31 @@ services:
        # above that uses the $TUGBOAT_REPO_ID environment variable.
        composer require drupal/scheduler_content_moderation_integration:dev-$TUGBOAT_REPO_ID

        # Get other useful modules to assist testing.
        composer require drupal/devel_generate
        composer require drupal/module_filter
        composer require drupal/config_inspector
        composer require drupal/config_update

        # Install Drupal on the site.
        vendor/bin/drush \
          --yes \
          --db-url=mysql://tugboat:tugboat@mysql:3306/tugboat \
          --site-name="SCMI ${TUGBOAT_PREVIEW_NAME}" \
          --site-name="${TUGBOAT_PREVIEW_NAME}" \
          --account-pass=admin \
          site:install standard

        # Show site status and GD image support status.
        vendor/bin/drush status-report
        vendor/bin/drush php:eval 'phpinfo()' | grep GD
        vendor/bin/drush php:eval 'print "imagepng() " . (function_exists("imagepng") ? "--yes\n" : "--no\n"); '
        vendor/bin/drush php:eval 'print "imagejpeg() " . (function_exists("imagejpeg") ? "--yes\n" : "--no\n"); '
        vendor/bin/drush php:eval 'print_r(gd_info());'

        # Get other useful modules to assist testing.
        composer require drupal/devel_generate
        composer require drupal/config_inspector

        # These modules are not compatible with Drupal 10 (yet) so only get them
        # when running Drupal 9.
        vendor/bin/drush core:status | awk "NR==1{print \$2\$3\$4}"
        vendor/bin/drush core:status | awk "NR==1{print \$2\$3\$4}" | \
          grep version:9 && composer require drupal/module_filter drupal/admin_toolbar drupal/config_update

        # Set up the files directory permissions.
        mkdir -p $DRUPAL_DOCROOT/sites/default/files
        chgrp -R www-data $DRUPAL_DOCROOT/sites/default/files
@@ -58,8 +75,12 @@ services:
        chmod -R g+w $DRUPAL_DOCROOT/sites/default/files

        # Enable modules.
        vendor/bin/drush --yes pm:enable scheduler devel devel_generate module_filter \
          scheduler_content_moderation_integration media config_update
        vendor/bin/drush --yes pm:enable scheduler devel devel_generate \
          scheduler_content_moderation_integration media

        # Enable modules that are only available at Drupal 9.
        vendor/bin/drush core:status | awk "NR==1{print \$2\$3\$4}" | \
          grep version:9 && vendor/bin/drush --yes pm:enable module_filter admin_toolbar config_update

        # Show versions.
        composer show drupal/scheduler | egrep 'name |vers'
@@ -89,15 +110,19 @@ services:
        vendor/bin/drush -y config-set media.type.image third_party_settings.scheduler.publish_past_date 'schedule'
        vendor/bin/drush config-get media.type.image third_party_settings

        vendor/bin/drush -y config-set media.type.document third_party_settings.scheduler.publish_enable 1
        vendor/bin/drush config-get media.type.document third_party_settings

        # Media settings.
        vendor/bin/drush -y config-set media.settings standalone_url 1
        vendor/bin/drush config-get media.settings
        vendor/bin/drush -y config-set field.field.media.image.field_media_image required 0
        vendor/bin/drush config-get field.field.media.image.field_media_image

        # Turn on moderation for article and image, using default editorial workflow
        # Turn on moderation for article, image and document, using default editorial workflow
        vendor/bin/drush -y config-set workflows.workflow.editorial type_settings.entity_types.node.0 article
        vendor/bin/drush -y config-set workflows.workflow.editorial type_settings.entity_types.media.0 image
        vendor/bin/drush -y config-set workflows.workflow.editorial type_settings.entity_types.media.1 document
        vendor/bin/drush config-get workflows.workflow.editorial type_settings.entity_types

        # Create a role which has all of the scheduler permissions.
@@ -127,8 +152,15 @@ services:
        vendor/bin/drush user-add-role 'moderator' 'Paisley publisher'

        # Generate content.
        vendor/bin/drush devel-generate-content 5 --bundles=article --authors=1,2,3,4 --verbose
        vendor/bin/drush devel-generate-media 5 --media-types=image --verbose
        vendor/bin/drush devel-generate-content 3 --bundles=article --authors=1,2,3,4 --verbose
        vendor/bin/drush devel-generate-content 3 --bundles=page --authors=1,2,3,4 --verbose
        # devel-generate-media does not have a --authors option.
        vendor/bin/drush devel-generate-media 3 --media-types=image --verbose
        vendor/bin/drush devel-generate-media 3 --media-types=document --verbose

        # Update form displays to match the entity type settings.
        vendor/bin/drush ev "\Drupal::service('scheduler.manager')->resetFormDisplayFields()"
        vendor/bin/drush ev "_scheduler_content_moderation_integration_reset_form_display()"

        # @todo Place the 'Switch users' block in first sidebar.
        # @todo Add 'content overview' to tools menu.