commit ab89ac00b1fc5b3fae4d11f678a189bf4adb0fb7 Author: Dave Pedu Date: Wed Feb 3 23:12:16 2016 -0800 initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b6c437b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:trusty + +ADD start /start + +RUN apt-get update && \ + apt-get install -y git curl buildbot buildbot-slave supervisor && \ + chmod +x /start && \ + mkdir /etc/supervisor/disabled + +ADD supervisor-buildbot-master.conf /etc/supervisor/disabled/supervisor-buildbot-master.conf +ADD supervisor-buildbot-slave.conf /etc/supervisor/disabled/supervisor-buildbot-slave.conf + +ADD supervisor.conf /etc/supervisor/conf.d/supervisor.conf + +#EXPOSE ["22", "8080", "9989"] +EXPOSE 22 +EXPOSE 8080 +EXPOSE 9989 +#VOLUME /opt/buildbot/ +ENTRYPOINT ["/start"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fe55e0 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +Run master: + +docker run -d -P -e ROLE=master -v /Users/dave/Documents/Code/docker-buildbot/combined/test/master.cfg:/opt/buildbot/master.cfg -v /Users/dave/Documents/Code/docker-buildbot/combined/test/state.sqlite:/opt/buildbot/state.sqlite --name="bb-master" buildbot + +Run slave: + +docker run -d -P -e ROLE=slave -e MADDR=172.17.0.2 -e MPORT=9989 --hostname=slave1 -e PASS=slaveone --name=bb-slave1 buildbot + +Run combined: + +docker run -d -P -e ROLE=both -e MPORT=9989 --hostname=slave1 -e PASS=slaveone --name=bb-slave1 buildbot + diff --git a/master.cfg b/master.cfg new file mode 100644 index 0000000..22e4c5d --- /dev/null +++ b/master.cfg @@ -0,0 +1,143 @@ +# -*- python -*- +# ex: set syntax=python: + +# This is a sample buildmaster config file. It must be installed as +# 'master.cfg' in your buildmaster's base directory. + +# This is the dictionary that the buildmaster pays attention to. We also use +# a shorter alias to save typing. +c = BuildmasterConfig = {} + +####### USERS +#user_mapping = { +# re.compile("testbuilder"): ["admin", "dave"] , +#} + +####### BUILDSLAVES + +# The 'slaves' list defines the set of recognized buildslaves. Each element is +# a BuildSlave object, specifying a unique slave name and password. The same +# slave name and password must be configured on the slave. +from buildbot.buildslave import BuildSlave +c['slaves'] = [BuildSlave("slave1", "slaveone"), BuildSlave("slave2", "slavetwo")] + +# 'slavePortnum' defines the TCP port to listen on for connections from slaves. +# This must match the value configured into the buildslaves (with their +# --master option) +c['slavePortnum'] = 9989 + +####### CHANGESOURCES + +# the 'change_source' setting tells the buildmaster how it should find out +# about source code changes. Here we point to the buildbot clone of pyflakes. + +from buildbot.changes.gitpoller import GitPoller +c['change_source'] = [] +#c['change_source'].append(GitPoller( +# 'git://github.com/buildbot/pyflakes.git', +# workdir='gitpoller-workdir', branch='master', +# pollinterval=300)) + +####### SCHEDULERS + +# Configure the Schedulers, which decide how to react to incoming changes. In this +# case, just kick off a 'runtests' build + +from buildbot.schedulers.basic import SingleBranchScheduler +from buildbot.schedulers.forcesched import ForceScheduler +from buildbot.changes import filter +c['schedulers'] = [] +#c['schedulers'].append(SingleBranchScheduler( +# name="all", +# change_filter=filter.ChangeFilter(branch='master'), +# treeStableTimer=None, +# builderNames=["runtests"])) +c['schedulers'].append(ForceScheduler( + name="force", + builderNames=["testbuild"])) + +####### BUILDERS + +# The 'builders' list defines the Builders, which tell Buildbot how to perform a build: +# what steps, and which slaves can execute them. Note that any particular build will +# only take place on one slave. + +from buildbot.process.factory import BuildFactory +from buildbot.steps.source.git import Git +from buildbot.steps.shell import ShellCommand + +#factory = BuildFactory() +# check out the source +#factory.addStep(Git(repourl='git://github.com/buildbot/pyflakes.git', mode='incremental')) +# run the tests (note that this will require that 'trial' is installed) +#factory.addStep(ShellCommand(command=["trial", "pyflakes"])) + +testbuild = BuildFactory() + +from buildbot.config import BuilderConfig + +c['builders'] = [] + +makeclean = ShellCommand(name = "test pwd", + command = ["pwd"], + description = "print pwd") +testbuild.addStep(makeclean) +c['builders'].append( + BuilderConfig(name = "testbuild", slavenames = ['slave1', 'slave2'], factory = testbuild) +) + + +#c['builders'].append( +# BuilderConfig(name="runtests", +# slavenames=["example-slave"], +# factory=factory)) + +####### STATUS TARGETS + +# 'status' is a list of Status Targets. The results of each build will be +# pushed to these targets. buildbot/status/*.py has a variety to choose from, +# including web pages, email senders, and IRC bots. + +c['status'] = [] + +from buildbot.status import html +from buildbot.status.web import authz, auth + +authz_cfg=authz.Authz( + # change any of these to True to enable; see the manual for more + # options + auth=auth.BasicAuth([("admin","balls")]), + gracefulShutdown = False, + forceBuild = True, #'auth', # use this to test your slave once it is set up + forceAllBuilds = False, + pingBuilder = True, + stopBuild = True, + stopAllBuilds = False, + cancelPendingBuild = False, +) +c['status'].append(html.WebStatus(http_port=8080, authz=authz_cfg)) + +####### PROJECT IDENTITY + +# the 'title' string will appear at the top of this buildbot +# installation's html.WebStatus home page (linked to the +# 'titleURL') and is embedded in the title of the waterfall HTML page. + +c['title'] = "buildbutt" +c['titleURL'] = "http://google.com/" + +# the 'buildbotURL' string should point to the location where the buildbot's +# internal web server (usually the html.WebStatus page) is visible. This +# typically uses the port number set in the Waterfall 'status' entry, but +# with an externally-visible host name which the buildbot cannot figure out +# without some help. + +c['buildbotURL'] = "http://192.168.99.100:8010/" + +####### DB URL + +c['db'] = { + # This specifies what database buildbot uses to store its state. You can leave + # this at its default for all but the largest installations. + 'db_url' : "sqlite:///state.sqlite", +} diff --git a/start b/start new file mode 100755 index 0000000..5ab9636 --- /dev/null +++ b/start @@ -0,0 +1,28 @@ +#!/bin/bash + +# Cleanly kill supervisor when container is stopped +trap 'kill $(jobs -p)' EXIT + +if [ "$ROLE" == "" ] ; then exit 1 ; fi + +if [ "$ROLE" == "master" ] || [ "$ROLE" == "both" ] ; then + echo "Creating master...." + cp /etc/supervisor/disabled/supervisor-buildbot-master.conf /etc/supervisor/conf.d/ + buildbot create-master /opt/buildbot/ +fi + +if [ "$ROLE" == "slave" ] || [ "$ROLE" == "both" ] ; then + if [ "$ROLE" == "both" ] ; then + MADDR=localhost + fi + if [ "$MADDR" == "" ] ; then exit 1 ; fi + if [ "$MPORT" == "" ] ; then exit 1 ; fi + if [ "$PASS" == "" ] ; then exit 1 ; fi + + echo "Creating slave..." + cp /etc/supervisor/disabled/supervisor-buildbot-slave.conf /etc/supervisor/conf.d/ + buildslave create-slave /opt/buildbot-slave/ $MADDR:$MPORT `hostname` $PASS +fi + +# start services +supervisord diff --git a/supervisor-buildbot-master.conf b/supervisor-buildbot-master.conf new file mode 100644 index 0000000..36f5530 --- /dev/null +++ b/supervisor-buildbot-master.conf @@ -0,0 +1,3 @@ +[program:buildbot] +command=/usr/bin/buildbot start --nodaemon /opt/buildbot/ +autorestart=true diff --git a/supervisor-buildbot-slave.conf b/supervisor-buildbot-slave.conf new file mode 100644 index 0000000..8d969e2 --- /dev/null +++ b/supervisor-buildbot-slave.conf @@ -0,0 +1,3 @@ +[program:buildbot-slave] +command=/usr/bin/buildslave start --nodaemon /opt/buildbot-slave/ +autorestart=true diff --git a/supervisor.conf b/supervisor.conf new file mode 100644 index 0000000..54296b8 --- /dev/null +++ b/supervisor.conf @@ -0,0 +1,2 @@ +[supervisord] +nodaemon=true