This article will walk you through the process of using Atlassian Bamboo to test Odoo on Ubuntu 14.04 and above.

The Odoo community typically uses TravisCI & RunBot to perform all unit/acceptance testing. This is an excellent workflow if you exclusively use Github for version control. This is not the case at LasLabs, so the TravisCI workflow is rather cumbersome.

This tutorial is also slightly relevant for Jenkins, as it is also compatible with JUnit XML test reports. If you are using Jenkins, you will need to adapt the Bamboo steps slightly, but the build script will transfer almost transfer over 1:1 (aside from the environment variables).

Security Note

The Docker group is basically equivalent to root, which means that this setup can introduce significant security holes into your infrastructure if the proper precautions are not taken.

As always, test infrastructure should be completely isolated from production in order to limit attack surface from any exploit that may result from the many stages of development.

In order to learn more about Docker security and possible implications in your environment, take a look at the Docker Security Docs.


The first piece of this puzzle is Docker, which allows us to setup a semi-isolated container for testing.

Following is a brief set of instructions for installation of Docker. For a more extended walkthrough, take a look at the Docker installation docs

  1. Add the Docker GPG key

    sudo apt-key adv \
      --keyserver hkp:// \
      --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

  2. Add the Docker repo to apt sources

    RELEASE=`lsb_release --codename | cut -d ':' -f2 | tr -d '\t'`
    echo "deb ubuntu-$RELEASE main" > \

  3. Update package index & existing applications

    sudo apt-get update &&
    sudo apt-get upgrade -y

  4. Purge the old Docker repo & add a policy to pull from the correct repo

    apt-get purge lxc-docker &&
    apt-cache policy docker-engine

  5. Install Prerequisites

    sudo apt-get install -y linux-image-extra-$(uname -r) &&
    sudo apt-get install -y apparmor

  6. Install Docker

    sudo apt-get install docker-engine

  7. Start Docker

    sudo service docker start

  8. Verify Docker is installed correctly. downloads a test image and runs it in a container. When the container runs, it prints an informational message. Then, it exits.

    sudo docker run hello-world

  9. The above command should output something similar to the below

    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    03f4658f8b78: Pull complete 
    a3ed95caeb02: Pull complete 
    Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
    Status: Downloaded newer image for hello-world:latest
    Hello from Docker.
    This message shows that your installation appears to be working correctly.
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    Share images, automate workflows, and more with a free Docker Hub account:
    For more examples and ideas, visit:


This article assumes that you already have a working Bamboo installation. Please follow the install docs if you have not already.


  1. Add the Bamboo user to the Docker group. Switch bamboo for the user that Bamboo runs under in your environment

    sudo usermod -a -G docker bamboo

  2. Restart Bamboo so that it picks up the new group permissions, and is able to use Docker

    sudo service bamboo restart


The next piece of this puzzle is created by Vauxoo, and is called Travis2Docker.

Travis2Docker will automatically create a Dockerfile and some nifty build scripts based on a .travis.yml file in a repository.

As mentioned in the Foreword, the primary testing strategy of Odoo is TravisCI, so nearly every Odoo repo already has a travis.yml file. Aside from this, the Odoo Community Association has tailored a significant amount of scripts around the Travis build environment.

Using the Travis files that are already integrated into the repos provides us the benefit of not having to recreate our build processes, as well as guarantees consistency of builds should a module be moved into the community repos.

We will install Travis2Docker as part of the build plan in order to guarantee that we are always using the new version

Build Plan

Now we need to create a build plan to run tests on our repo

  1. Log in to Bamboo, click Create at the top, then Create a new plan
    Bamboo New Build Plan

  2. Fill out the form to create the plan & link it to the desired repo
    Bamboo New Build Plan Configuration

  3. The first build task should be the Source Code Checkout task that is added by default. No changes need to be made to this task.

  4. Add a new Script Task, and name it whatever you would like. We will use this task to generate the Docker image, run the container, and run the tests.
    Bamboo New Script Task

  5. Add the following script to the new task:

    # Setup virtualenv
    virtualenv _venv
    # Install Pip
    curl --silent --show-error --retry 5 | _venv/bin/python
    # Configure environment
    export PATH=${}/tmp/usr/local/bin:$PATH
    export PYTHONPATH=${}/tmp/usr/local/lib/python2.7/dist-packages:$PYTHONPATH
    # Fix
    # Note - requires libffi-dev
    _venv/bin/pip install --upgrade pyopenssl ndg-httpsclient pyasn1
    # Install Travis2Docker
    _venv/bin/pip install --upgrade git+
    # Clear the old images
    rm -Rf ${}/docker
    # Generate Docker Scripts
    _venv/bin/travisfile2dockerfile \
      ${bamboo.planRepository.repositoryUrl} \
      ${bamboo.planRepository.branchName} \
      --root-path=${}/docker \
      --docker-image="laslabs/docker-odoo-image" \
      --include-cleanup \
      --build-extra-args="--no-cache" \
      --exclude-after-success \
      --run-extra-args="-tP -e LANG=C.UTF-8 -v ${}/_results:/_results"
    # Uncomment below for Lints tests
    # cd ${}/docker/script/*/*/*/1
    # Uncomment below for standard tests server - odoo/odoo
    cd ${}/docker/script/*/*/*/2
    # Uncomment below for OCA backports test server - OCA/OCB
    # cd ${}/docker/script/*/*/*/3
    # Build
    # Rewrite the default options for compat with Bamboo
    # sed -i 's/ -itP / -tP /g' ./
    # Start container and run tests

  6. Note that the above may need to be tailored a bit depending on the Travis file. The above is the standard organization, but it could vary. Look in travis.yml for the env section. The above example is for the following env:

      - VERSION="9.0" LINT_CHECK="1"
      - VERSION="9.0" ODOO_REPO="odoo/odoo" TESTS="1" LINT_CHECK="0"
      - VERSION="9.0" UNIT_TEST="1" LINT_CHECK="0"

  7. Add a new JUnit Parser task, which will allow Bamboo to parse the test results instead of just viewing a log. Name it whatever you would like.
    Bamboo New JUnit Parser

  8. Change the results directory to **/_results/*.xml, and save.
    Bamboo JUnit Configuration

  9. Save and run the plan – we should have green lights! Note that the first build will take an extraordinarily long time due to the initial download of the Docker image. Subsequent tests should be much quicker.
    Bamboo Test Success

  10. From here, you would want to copy a new job in the same project for each of the Travis build jobs (typically 3 total). You can easily clone the existing job, then just change the docker script directory from 1 to 2 or 3.