simplytest-8.x-4.x-dev/modules/simplytest_tugboat/templates/simplytest-tugboat-config-7-yml.html.twig
modules/simplytest_tugboat/templates/simplytest-tugboat-config-7-yml.html.twig
{#
/**
* Tugboat variables
* https://docs.tugboat.qa/reference/environment-variables/
*
* Simplytest progress status list:
* @see \Drupal\simplytest_tugboat\InstanceManager::getStatusList()
*
* Available variables:
*
* - additionals: array of additional projects to install
* - drupal_core_version: the version (branch or tag) of Drupal core to use
* - instance_id
* - patches: array of URLs to patch files to apply
* - perform_install (bool): whether to 'drush si'
* - project: the primary project to install
* - project_type: the type (Module, Theme, or Distribution) of the primary project
* - project_version: the version string for the primary project
* - status_endpoint: The base_url + route uri + instance id for reporting
* status back to the simplytest server.
*/
#}
{% set interface = 'Drupal\\simplytest_tugboat\\InstanceManagerInterface' %}
# Drupal 7
services:
# What to call the service hosting the site.
php:
# Use PHP 7.2 with Apache
image: tugboatqa/php:7.2-apache
# Set this as the default service. This does a few things
# 1. Clones the git repository into the service container
# 2. Exposes port 80 to the Tugboat HTTP proxy
# 3. Routes requests to the preview URL to this service
default: true
depends: mysql
# A set of commands to run while building this service
commands:
build:
# Fetch the right drupal version.
- composer self-update
- cd "${DOCROOT}" && git config core.fileMode false
- cd "${DOCROOT}" && git fetch --all
{% set used_version = (project == 'drupal') ? project_version : drupal_core_version %}
{% if used_version ends with 'x' %}
- cd "${DOCROOT}" && git reset --hard origin/{{ used_version }}
{% else %}
- cd "${DOCROOT}" && git reset --hard {{ used_version }}
{% endif %}
# Start the downloads
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::DOWNLOAD') }}
# Load drupal code base.
{% if project_type == 'Module' or project_type == 'Theme' %}
- drush -r "${DOCROOT}" dl {{ project }}-{{ project_version }} -y
{% endif %}
{% for additional in additionals %}
- drush -r "${DOCROOT}" dl {{ additional }} -y
{% endfor %}
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::PATCHING') }}
{% if patches is not empty %}
# Apply patches.
{% for patch in patches %}
# Download the patch.
- wget {{ patch }} --output-document="/tmp/patch.{{ instance_id }}"
{% if project == 'drupal' %}
- cd "${DOCROOT}" && patch -p1 < "/tmp/patch.{{ instance_id }}"
{% elseif project_type == 'Distribution' %}
- cd "${DOCROOT}/profiles/contrib/{{ project }}" && patch -p1 < "/tmp/patch.{{ instance_id }}"
{% else %}
- cd "${DOCROOT}/{{ project_type | lower }}s/contrib/{{ project }}" && patch -p1 < "/tmp/patch.{{ instance_id }}"
{% endif %}
- rm "/tmp/patch.{{ instance_id }}"
{% endfor %}
{% endif %}
- cd "${DOCROOT}" && chmod -R 777 sites/default
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::INSTALLING') }}
{% if perform_install %}
# Install drupal.
- drush -r "${DOCROOT}" si {{ (project_type == 'Distribution') ? project : 'standard' }} --account-name=admin --account-pass=admin -y
- cd "${DOCROOT}" && chmod -R 777 sites/default/files
{% if project_type == 'Module' or project_type == 'Theme' %}
- drush -r "${DOCROOT}" en {{ project }} -y
{% endif %}
{% for additional in additionals %}
- drush -r "${DOCROOT}" en {{ additional }} -y
{% endfor %}
{% endif %}
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::FINALIZE') }}
# What to call the service hosting MySQL. This name also acts as the
# hostname to access the service by from the php service.
mysql:
# Use the latest available 5.x version of MySQL
image: tugboatqa/mysql:5
