Search code examples
dockerbuildbot

How to configure the buildbot docker container using BUILDBOT_CONFIG_URL


The documentation of the official docker container for buildbot expects the BUILDBOT_CONFIG_URL environment variable to point to a .tar.gz file accessible via HTTP containing the master.cfg file.

  • How is this supposed to work if the master.cfg file is not a single file but rather imports other files like the private.py file?
  • Is it also possible configure the docker container with physical configuration files?
version: '2'
services:
  buildbot:
    image: buildbot/buildbot-master:master
    env_file:
      - db.env
    environment:
      - BUILDBOT_CONFIG_DIR=config
      - BUILDBOT_CONFIG_URL=https://github.com/buildbot/buildbot-docker-example-config/archive/master.tar.gz
      - BUILDBOT_WORKER_PORT=9989
      - BUILDBOT_WEB_URL=http://localhost:8010/
      - BUILDBOT_WEB_PORT=tcp:port=8010
    links:
      - db
    depends_on:
      - db
    ports:
      - "8010:8010"
  db:
    env_file:
      - db.env
    image: "postgres:9.4"
    expose:
      - 5432

Solution

  • The docker example uses this file as the basis of the docker image: https://github.com/buildbot/buildbot/blob/master/master/Dockerfile

    Which defines as its entrypoint this script: https://github.com/buildbot/buildbot/blob/master/master/docker/start_buildbot.sh

    In that script the configuration is explicitly handled by downloading and extracting:

    until curl -sL $BUILDBOT_CONFIG_URL | tar -xz --strip-components=1 --directory=$B/$BUILDBOT_CONFIG_DIR

    and further linked as the master.cfg file. So all in all the magic depends on the additional script setting up the configuration file so it matches the typical setting.