Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
This is the new Drupal testbot using docker containers, main url is:
PHP Shell

Docker Drupal testbots on your local box!

Test your Drupal patches locally with docker.

Jump to topic:

This repo contains a recipe for making a Docker containers for Drupal patch testing, using Linux, Apache, PHP and MariaDB/PostgreSQL/MySQL/Sqlite.

This is part of the core code powering the future version of Drupal automated-testing infrastructure at .

Why is this awesome?

a) Test patches on your local box or b) Test multiple patches and multiple modules at once. c) Test any Drupal version. d) Get realtime output. e) Choose mariadb, postgresql, mysql, sqlite. f) Choose PHP5.3/5.4/5.5/5.6 g) Test offline.

Quick Linux Instructions (for the impatient):

(re)Build all and start containers (only once):

git clone {thisrepo}
cd drupalci_testbot
sudo ./scripts/ cleanup

Quick Vagrant MAC/Windows instructions:

Docker will not run natively on MAC/Windows, Install Virtualbox, Vagrant and run:

git clone {thisrepo}
cd drupalci_testbot
vagrant up

Run some group tests:

sudo DCI_TESTGROUPS="Action,Bootstrap" DCI_DRUPALBRANCH="8.0.x" DCI_PATCH="/path/to/your.patch,." ./

See more examples bellow on: "6- RUN EXAMPLES"

Full Instructions:

1- Install docker:

curl | sudo sh -x

2- Clone this repo somewhere in your Linux box

git clone {thisrepo}
cd drupalci_testbot

3- Build the database image

cd containers/database/mysql
sudo ./

4- Start the DB container and check it's running on port 3306

cd containers/database/mysql
sudo ./

5- Build the WEB images

cd containers/base/web-base
sudo ./
cd containers/web/web-[PHP_VERSION]
sudo ./


Results will be available at: {USERHOME}/testbotdata/BUILD_{DATE}/results and at the live running terminal

Run 'search_api' module tests, with one patch against D8 and git sandbox:

sudo DCI_TESTGROUPS="--module 'search_api'" \

Run Action and Node tests, 2 LOCAL patches, using 4 CPUs, against D8:

cd containers/web/

sudo \
DCI_TESTGROUPS="Action,Node" \
DCI_PATCH="/tmp/1942178-config-schema-user-28.patch,.;/tmp/1942178-config-schema-30.patch,." \

Run all tests using 4 CPUs, 1 core patch, 1 tgz module, against D8:

cd containers/web/

sudo \
DCI_PATCH=",." \

Run all tests using 6 CPUs, 2 patches and 2 modules on D7.26:

cd containers/web/

sudo \
DCI_DEPENDENCIES="flag,payment"  \
DCI_PATCH=",sites/all/modules/flag;,sites/all/modules/payment" \

And that's it.

./ Options

Bellow is the list of Environment Variables and defaults that can be passed to the ./ runner. These options can also be added to a $HOME/.drupalci/config file.

# Any valid Drupal branch or tag, like 8.0.x, 7.x or 7.30:

# The identifier used by jenkins to name the Drupal docroot where all is stored:
DCI_IDENTIFIER="build_$(date +%Y_%m_%d_%H%M%S)" # Only [a-z0-9-_.] allowed

# The place where Drupal repos and DrupalDocRoot indentifiers are kept:

# Request the runner to update the Drupal local repo before local cloning:
DCI_UPDATEREPO="false"  # true to force repos update

# By default we put the Drupal repo and docroots on the same place, but you can have BUILDSDIR elsewhere:

# Same for the workspace:

# Install modules:
DCI_DEPENDENCIES=""     # module1,module2,module2...

# Git clone sandboxes:
DCI_DEPENDENCIES_GIT="" # gitrepo1,branch;gitrepo2,branch;...

# Download tgz modules:
DCI_DEPENDENCIES_TGZ="" # module1_url.tgz,module1_url.tgz,...

# Download and patch one or several patches:
DCI_PATCH=""            # patch_url,apply_dir;patch_url,apply_dir;...

# PHP version to run tests on 5.3/5.4/5.5:

# Database type and version selection, from mysql/mariadb/pgsql/sqlite:

# Username & Password

# Default dbcontainer and link

# Try to use core "none" install tests or "drush"

# Executes other funcionality in the container prepending CMD.

# Debug container shell with DCI_CMD="/bin/bash"
DCI_VERBOSE="false"     # true will give verbose

# How many cpus to use per run:

# Testgroups to run, eg. "--all":
DCI_TESTGROUPS="Bootstrap" #TESTS TO RUN eg.--all

# Default runscript
DCI_RUNSCRIPT="php ./scripts/ --php /usr/bin/php --url 'http://localhost' --color --concurrency ${DCI_CONCURRENCY} --xml '/var/workspace/results' ${DCI_TESTGROUPS} "

Using a config.yml or config file

The runner can use one config per run instead of env variables.

  • A config or a config.yml file can be placed into $HOME/.drupalci/config or $HOME/.drupalci/config.yml

    While the config file just has the bash variables per line the config.yml follows the yaml format, like this example:

DCI_DBTYPE  : mysql
DCI_DBVER   : 5.5
DCI_TESTGROUPS  : Bootstrap,Action
DCI_RUNSCRIPT : php ./core/scripts/ --php /usr/bin/php --url 'http://localhost' --color --concurrency 4  --xml '/var/workspace/results'
DCI_CMD     : /bin/bash /

Only one file type can be use per run.

if [ -f $HOME/.drupalci/config ] && [ -f $HOME/.drupalci/config.yml ]; then echo "Runner can only use one config per run:" echo "$HOME/.drupalci/config &" echo "$HOME/.drupalci/config.yml are in conflict" echo "Please remove one or both and try again!" exit 1 fi

Source $HOME/.drupalci/config environment variables:

if [ -f $HOME/.drupalci/config ]; then echo "Sourcing your default variables from $HOME/.drupalci/config "; source $HOME/.drupalci/config; elif [ -f $HOME/.drupalci/config.yml ]; then echo "Sourcing your default variables from $HOME/.drupalci/config.yml "; eval $(parse_yaml $HOME/.drupalci/config.yml); fi

What tests can I run?

sudo \
DCI_RUNSCRIPT="/usr/bin/php ./core/scripts/ --list" \

If you need to remove the old web image just run this sequence:

sudo docker images | grep "drupalci/web" | awk '{print $3}' | xargs -n1 -I {} sudo docker rm {}


Travis support is provided via an upstream project call PrivateTravis.

To perform a Travis build in it's simplest form run the following command:

$ drupalci travis > run && sh run

The above performs 2 tasks:

  • Converts a .travis.yml file to a set of Docker commands.
  • Pipes and runs the commands in a single script (to avoid PHP running Docker running PHP).

For more information on this command see the PrivateTravis documentation:

7 - Clean Up

a) Results will be saved at: {USERHOME}/testbotdata/BUILD_{DATE}/results/ so you can delete testbotdata/BUILD_{DATE} after you collect your information

b) Docker generates several runs: While i am developing i use this to rm all old instances

sudo docker ps -a | awk '{print $1}' | xargs -n1 -I {} sudo docker rm {}

Current Structure:

├── containers
│   ├── base
│   │   ├── testbot_base
│   │   └── web-base
│   │       └── conf
│   │           ├── apache2
│   │           ├── php5
│   │           ├── scripts
│   │           └── supervisor
│   ├── database
│   │   ├── mariadb-10.0
│   │   │   └── conf
│   │   ├── mariadb-5.5
│   │   │   └── conf
│   │   ├── mysql-5.5
│   │   │   └── conf
│   │   ├── pgsql-9.1
│   │   │   └── conf
│   │   └── pgsql-9.4
│   │       └── conf
│   └── web
│       ├── web-5.4
│       └── web-5.5
├── drupal
├── jobs
│   ├── phpunit
│   ├── simpletest
│   └── syntax
├── scripts
│   └── src
└── vendor


We have the ability to generate a binary for distrubtion. To build the .phar file run the following command:

bin/box build


Feel free to fork and contribute to this code. :)

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.