Run Selenium tests using Quibble and Docker

Dependencies are Git Python 3, and Docker Community Edition (CE).

First, the general setup.

$ git clone https://gerrit.wikimedia.org/r/p/integration/quibble
...
       
$ cd quibble/

$ python3 -m pip install -e .
...

$ docker pull docker-registry.wikimedia.org/releng/quibble-stretch:latest
...
(2m 26s)

The simplest, and slowest, way to run Quibble.

$ docker run -it --rm \
 docker-registry.wikimedia.org/releng/quibble-stretch:latest
...
(12m 54s)

Speed things up by using local repositories.

$ mkdir -p ref/mediawiki/skins

$ git clone --bare https://gerrit.wikimedia.org/r/mediawiki/core ref/mediawiki/core.git
...
(3m 40s)

$ git clone --bare https://gerrit.wikimedia.org/r/mediawiki/vendor ref/mediawiki/vendor.git
...

$ git clone --bare https://gerrit.wikimedia.org/r/mediawiki/skins/Vector ref/mediawiki/skins/Vector.git
...

$ mkdir cache
$ chmod 777 cache

$ mkdir -p log
$ chmod 777 log

$ mkdir -p src
$ chmod 777 src

$ docker run -it --rm \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch:latest
...
(18m 0s)

The second run of everything, just to see if things get faster.

$ docker run -it --rm \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch:latest
...
(16m 50s)

If you get this error message

A LocalSettings.php file has been detected. To upgrade this installation, please run update.php instead

just remove the file

$ rm src/LocalSettings.php

Speed things up by skipping Zuul and not installing dependencies.

$ docker run -it --rm \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch:latest --skip-zuul --skip-deps
...
(6m 17s)

Speed things up by just running Selenium tests.

$ docker run -it --rm \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch:latest --skip-zuul --skip-deps --run selenium
...
(1m 19s)
Written by zeljkofilipin on May 2 2018, 1:46 PM.
Software Engineer (International contractor)
Projects
None
Subscribers
hashar, Niedzielski

I found this tutorial useful in combination with the documentation on https://doc.wikimedia.org/quibble/ and the T194970 session. When running locally, the following commands with this convenient user / group hack seem to work well and keep all the files under the current user:

git clone --bare https://gerrit.wikimedia.org/r/mediawiki/core ref/mediawiki/core.git
git clone --bare https://gerrit.wikimedia.org/r/mediawiki/vendor ref/mediawiki/vendor.git
git clone --bare https://gerrit.wikimedia.org/r/mediawiki/skins/Vector ref/mediawiki/skins/Vector.git

mkdir cache log src
docker run -it --rm -u "$(id -u "$USER"):$(id -g "$USER")" \
  -v /etc/group:/etc/group:ro \
  -v /etc/passwd:/etc/passwd:ro \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch:latest

When we use the bare repos, do we need to manually update them?

@Niedzielski I am not familiar with how Quibble works internally, @hashar should know!