-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b130dae
Showing
10 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cache/infrastructure/ | ||
cache/releases/ | ||
cache/snapshots/ | ||
common/secrets.env | ||
master/db.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Setting up master: | ||
---------------------------------- | ||
``` | ||
cd /srv/buildbot/ | ||
git clone https://github.com/D-Programming-GDC/buildbot-gdc.git . | ||
cat > master/db.env << EOF | ||
POSTGRES_DB=buildbot | ||
POSTGRES_USER=buildbot | ||
POSTGRES_PASSWORD=psqlpasswd # Substitute password here. Do not commit this. | ||
POSTGRES_HOST=x.x.x.x # Substitute address of database. | ||
EOF | ||
cat > common/secrets.env << EOF | ||
# Secrets shared between master and workers. | ||
WORKERPASS=password # Substitute password here. Do not commit this. | ||
BUILDMASTER_CLIENT_ID=github_client_id # Same. | ||
BUILDMASTER_CLIENT_SECRET=github_client_secret # Same. | ||
EOF | ||
docker-compose up -d buildbot | ||
``` | ||
|
||
Updating the master: | ||
---------------------------------- | ||
``` | ||
cd /srv/buildbot/ | ||
docker-compose stop buildbot | ||
git pull | ||
docker-compose up --build -d buildbot | ||
``` | ||
|
||
|
||
Adding a new worker (local): | ||
---------------------------------- | ||
* docker-compose.yml: | ||
- Create a new service entry. | ||
``` | ||
<service-name>: | ||
build: | ||
context: workers | ||
args: | ||
TARGET: <target configuration for worker> | ||
env_file: | ||
- common/common.env | ||
- common/secrets.env | ||
environment: | ||
HOSTNAME: <hostname> | ||
WORKERNAME: <worker name> | ||
volumes: | ||
- /srv/buildbot/cache:/buildbot/cache | ||
links: | ||
- buildbot | ||
``` | ||
|
||
* workers/install-target-deps.sh: | ||
- Add switch case if this is a new TARGET that requires extra software packages | ||
other than native. | ||
|
||
* master/master.cfg: | ||
- Add worker entries to the `builder_map` in master/master.cfg, one for each | ||
target that the worker is supposed to handle. The format is: `'target-os-triplet': '<worker name>'` | ||
|
||
|
||
Adding a new worker (remote): | ||
---------------------------------- | ||
``` | ||
cd /srv/buildbot/ | ||
git clone https://github.com/D-Programming-GDC/buildbot-gdc.git . | ||
``` | ||
|
||
Update files as per adding a new worker (local), except that in docker-compose.yml, | ||
don't include `links: buildbot`. | ||
|
||
Set-up a stunnel to the buildbot master, add `x.x.x.x buildbot` entry to /etc/hosts. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Environment variables common between master and workers. | ||
BUILDMASTER_PORT=9989 | ||
|
||
# Environment variables used by workers. | ||
BUILDMASTER=buildbot | ||
WORKER_ENVIRONMENT_BLACKLIST=WORKERPASS BUILDMASTER* DOCKER* security_updates_as_of WORKER_ENVIRONMENT_BLACKLIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: '2' | ||
services: | ||
buildbot: | ||
build: | ||
context: master | ||
env_file: | ||
- common/common.env | ||
- common/secrets.env | ||
- master/db.env | ||
environment: | ||
HOSTNAME: buildbot.gdcproject.org | ||
BUILDBOT_DB_URL: postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}/{POSTGRES_DB} | ||
BUILDBOT_CONFIG_DIR: config | ||
BUILDBOT_WEB_URL: http://localhost:8082/ | ||
BUILDBOT_WEB_PORT: 8082 | ||
ports: | ||
- "8082:8082" | ||
|
||
worker-cross: | ||
build: | ||
context: workers | ||
args: | ||
TARGET: all-linux-gnu | ||
env_file: | ||
- common/common.env | ||
- common/secrets.env | ||
environment: | ||
HOSTNAME: worker1.dgnu.org | ||
WORKERNAME: gdc-ubuntu-cross | ||
volumes: | ||
- /srv/buildbot/cache:/buildbot/cache | ||
links: | ||
- buildbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM buildbot/buildbot-master:v0.9.9.post1 | ||
|
||
RUN pip install requests | ||
|
||
COPY master.cfg /var/lib/buildbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# -*- python -*- | ||
# ex: set filetype=python: | ||
|
||
# This is a sample buildmaster config file. It must be installed as | ||
# 'master.cfg' in your buildmaster's base directory. | ||
|
||
import os | ||
|
||
from buildbot.plugins import * | ||
|
||
# This is the dictionary that the buildmaster pays attention to. We also use | ||
# a shorter alias to save typing. | ||
c = BuildmasterConfig = {} | ||
|
||
builder_map = { | ||
'alpha-linux-gnu': 'gdc-ubuntu-cross', | ||
'arm-linux-gnueabi': 'gdc-ubuntu-cross', | ||
'arm-linux-gnueabihf': 'gdc-ubuntu-cross', | ||
'aarch64-linux-gnu': 'gdc-ubuntu-cross', | ||
'hppa-linux-gnu': 'gdc-ubuntu-cross', | ||
'hppa64-linux-gnu': 'gdc-ubuntu-cross', | ||
'mips-linux-gnu': 'gdc-ubuntu-cross', | ||
'mips64-linux-gnuabi64': 'gdc-ubuntu-cross', | ||
'mips64el-linux-gnuabi64': 'gdc-ubuntu-cross', | ||
'mipsel-linux-gnu': 'gdc-ubuntu-cross', | ||
'powerpc-linux-gnu': 'gdc-ubuntu-cross', | ||
'powerpc-linux-gnuspe': 'gdc-ubuntu-cross', | ||
'powerpc64-linux-gnu': 'gdc-ubuntu-cross', | ||
'powerpc64le-linux-gnu': 'gdc-ubuntu-cross', | ||
's390x-linux-gnu': 'gdc-ubuntu-cross', | ||
'sh4-linux-gnu': 'gdc-ubuntu-cross', | ||
'sparc64-linux-gnu': 'gdc-ubuntu-cross', | ||
} | ||
|
||
builders = sorted(set(builder_map.iterkeys())) | ||
workers = sorted(set(builder_map.itervalues())) | ||
|
||
|
||
####### WORKERS | ||
|
||
c['workers'] = [worker.Worker(workername, os.environ["WORKERPASS"], max_builds=1) | ||
for workername in workers] | ||
|
||
c['protocols'] = {'pb': {'port': os.environ["BUILDMASTER_PORT"]}} | ||
|
||
####### CHANGESOURCES | ||
|
||
c['change_source'] = [] | ||
c['change_source'].append(changes.GitPoller(repourl='git://github.com/D-Programming-GDC/GDC.git', | ||
branch='master', | ||
pollinterval=300, | ||
workdir='gitpoller-workdir')) | ||
|
||
####### SCHEDULERS | ||
|
||
c['schedulers'] = [] | ||
c['schedulers'].append(schedulers.SingleBranchScheduler(name="all", branch='master', | ||
treeStableTimer=60, | ||
builderNames=builders)) | ||
c['schedulers'].append(schedulers.ForceScheduler(name="force", | ||
builderNames=builders)) | ||
|
||
####### BUILDERS | ||
|
||
factory = util.BuildFactory() | ||
factory.addStep(steps.GitHub(repourl='http://github.com/D-Programming-GDC/GDC.git', | ||
mode='incremental', method='fresh')) | ||
factory.addStep(steps.ShellCommand(name='configure', command=['/buildbot/buildci.sh', 'configure'])) | ||
factory.addStep(steps.ShellCommand(name='build', command=['/buildbot/buildci.sh', 'build'])) | ||
factory.addStep(steps.ShellCommand(name='runtests', command=['/buildbot/buildci.sh', 'alltests'])) | ||
|
||
c['builders'] = [util.BuilderConfig(name=builder, | ||
workername=workername, | ||
factory=factory, | ||
env={'BUILDBOT': 'true', | ||
'BUILDBOT_TARGET': builder, | ||
'BUILDBOT_CACHE_DIR': '/buildbot/cache'}) | ||
for builder, workername in builder_map.iteritems()] | ||
|
||
####### STATUS TARGETS | ||
|
||
c['status'] = [] | ||
|
||
c['www'] = { | ||
'port': os.environ["BUILDBOT_WEB_PORT"], | ||
'plugins': dict(waterfall_view=True, console_view=True), | ||
'auth': util.GitHubAuth(os.environ['BUILDMASTER_CLIENT_ID'], | ||
os.environ['BUILDMASTER_CLIENT_SECRET'], | ||
apiVersion=4, getTeamsMembership=True), | ||
'authz': util.Authz( | ||
allowRules=[ | ||
util.AnyControlEndpointMatcher(role='GDC Admins'), | ||
util.ForceBuildEndpointMatcher(role='GDC Admins'), | ||
util.StopBuildEndpointMatcher(role='GDC Admins'), | ||
util.RebuildBuildEndpointMatcher(role='GDC Admins'), | ||
util.EnableSchedulerEndpointMatcher(role='GDC Admins'), | ||
], | ||
roleMatchers=[ | ||
util.RolesFromGroups(groupPrefix='D-Programming-GDC/'), | ||
], | ||
), | ||
} | ||
|
||
####### PROJECT IDENTITY | ||
|
||
c['title'] = "gdc" | ||
c['titleURL'] = "https://gdcproject.org" | ||
|
||
c['buildbotURL'] = os.environ["BUILDBOT_WEB_URL"] | ||
|
||
####### DB URL | ||
|
||
c['db'] = { | ||
'db_url' : os.environ["BUILDBOT_DB_URL"].format(**os.environ), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM buildbot/buildbot-worker:v0.9.9.post1 | ||
|
||
ENV DOCKER_GCC_VERSION 5 | ||
|
||
# The target that the worker will build for. | ||
ARG TARGET | ||
|
||
# Switch USER back to root to install common packages. | ||
USER root | ||
|
||
# Target specific dependencies. | ||
COPY install-target-deps.sh /buildbot | ||
RUN bash install-target-deps.sh $TARGET | ||
|
||
COPY buildci.sh /buildbot | ||
|
||
USER buildbot |
Oops, something went wrong.