diff --git a/buildbot/master.cfg b/buildbot/master.cfg new file mode 100644 index 0000000..a6c1be2 --- /dev/null +++ b/buildbot/master.cfg @@ -0,0 +1,134 @@ +# -*- python -*- +# ex: set filetype=python: + +from buildbot.plugins import * +from buildbot.process.properties import Property + +# 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 = {} + +####### WORKERS + +# The 'workers' list defines the set of recognized workers. Each element is +# a Worker object, specifying a unique worker name and password. The same +# worker name and password must be configured on the worker. +#c['workers'] = [worker.Worker("worker", "work3rP@ss!")] +c['workers'] = [ + worker.DockerLatentWorker('docker', 'work3rP@ss!', + docker_host='unix:///var/run/docker.sock', + image='buildbot-worker', + hostconfig={'cap_add': ['SYS_ADMIN']}) +] +# 'protocols' contains information about protocols which master will use for +# communicating with workers. You must define at least 'port' option that workers +# could connect to your master with this protocol. +# 'port' must match the value configured into the workers (with their +# --master option) +c['protocols'] = {'pb': {'port': 9989}} + +####### CHANGESOURCES + +# the 'change_source' setting tells the buildmaster how it should find out +# about source code changes. Here we point to the buildbot version of a python hello-world project. + +c['change_source'] = [] +# FIXME +# c['change_source'].append(changes.GitPoller( +# 'git://github.com/buildbot/hello-world.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 'qgis' build + +c['schedulers'] = [] +# FIXME +# c['schedulers'].append(schedulers.SingleBranchScheduler( +# name="all", +# change_filter=util.ChangeFilter(branch='master'), +# treeStableTimer=None, +# builderNames=["qgis"])) +c['schedulers'].append(schedulers.ForceScheduler( + name="Force_QGIS", + builderNames=["qgis"])) + +####### BUILDERS + +# The 'builders' list defines the Builders, which tell Buildbot how to perform a build: +# what steps, and which workers can execute them. Note that any particular build will +# only take place on one worker. + +def rpm_name(rc, stdout, stderr): + return stdout.split()[3] + +qgis_factory = util.BuildFactory() +qgis_factory.addStep(steps.Git(repourl=Property('repository', 'git://github.com/qgis/qgis.git'), mode='full', + method='clobber', shallow=True, name="Clone")) +qgis_factory.addStep(steps.ShellCommand(command=["./buildrpms.sh", "-s", "-u"], + workdir="build/rpm", name="Build SRPM", env={"_MOCK_OLD_CHROOT": "true"})) +qgis_factory.addStep(steps.ShellCommand(command="ls", workdir="build/rpm/result", name="List artifacts")) +qgis_factory.addStep(steps.SetPropertyFromCommand(command="ls qgis*.src.rpm", property="srpm", + workdir="build/rpm/result", name="Get artifacts")) +qgis_factory.addStep(steps.ShellCommand(command=["copr-cli", "build", "qgis-testing", util.Interpolate("%(prop:srpm)s")], + workdir="build/rpm/result", timeout=10800, name="Build on COPR")) + +# th_factory = util.BuildFactory() # dummy + +c['builders'] = [] +c['builders'].append( + util.BuilderConfig(name="qgis", + workernames=["docker"], + factory=qgis_factory)) + +####### BUILDBOT SERVICES + +# 'services' is a list of BuildbotService items like reporter targets. The +# status of each build will be pushed to these targets. buildbot/reporters/*.py +# has a variety to choose from, like IRC bots. + +c['services'] = [] + +####### PROJECT IDENTITY + +# the 'title' string will appear at the top of this buildbot installation's +# home pages (linked to the 'titleURL'). + +c['title'] = "Build Server" +c['titleURL'] = "https://build.server" + +# the 'buildbotURL' string should point to the location where the buildbot's +# internal web server is visible. This typically uses the port number set in +# the 'www' entry below, but with an externally-visible host name which the +# buildbot cannot figure out without some help. + +c['buildbotURL'] = "https://build.server" + +# minimalistic config to activate new web UI +c['www'] = dict(port=8010, + plugins=dict(waterfall_view={}, console_view={}, grid_view={})) + +c['www']['authz'] = util.Authz( + allowRules = [ + util.AnyControlEndpointMatcher(role="admins", defaultDeny=True), + util.AnyEndpointMatcher(role="admins", defaultDeny=False), + # if future Buildbot implement new control, we are safe with this last rule + ], + roleMatchers = [ + util.RolesFromUsername(roles=['admins'], usernames=['']) + ] +) +c['www']['auth'] = util.UserPasswordAuth([('','')]) + +####### 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/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..c4d4629 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,25 @@ +# vi:syntax=dockerfile +FROM fedora:26 +MAINTAINER Daniele ViganĂ² + +RUN dnf install -y tar bzip2 git python3-pip mock copr-cli && \ + dnf clean all +# Use a Twisted binary wheel to avoid too many dependencies +RUN pip3 install https://daniele.vigano.me/files/pypi/Twisted-17.9.0-cp36-cp36m-linux_x86_64.whl \ + buildbot-worker + +RUN useradd -u 1003 builder && \ + usermod -a -G mock builder + +USER builder +ENV HOME /home/builder +WORKDIR ${HOME} + +COPY copr $HOME/.config/copr + +RUN buildbot-worker create-worker $HOME 172.17.0.1 docker work3rP@ss! && \ + echo "Daniele ViganĂ² " > info/admin && \ + echo "Docker running Fedora 26 (x86_64)" > info/host + +ENTRYPOINT ["/usr/bin/buildbot-worker"] +CMD ["start", "--nodaemon"] diff --git a/docker/copr b/docker/copr new file mode 100644 index 0000000..ea87e8f --- /dev/null +++ b/docker/copr @@ -0,0 +1,6 @@ +[copr-cli] +login = +username = +token = +copr_url = https://copr.fedorainfracloud.org +# expiration date: 2018-04-04