Skip to content

Instantly share code, notes, and snippets.

@kamituel
Created April 11, 2014 18:33
Show Gist options
  • Save kamituel/10490544 to your computer and use it in GitHub Desktop.
Save kamituel/10490544 to your computer and use it in GitHub Desktop.
B2G - Buildbot. Put files into right directories: master/master.cfg; ./restart.sh; ./start.sh; master/templates/root.html; master/templates/layout.html. Install Buildbot (tutorial: http://kamituel.tumblr.com/tagged/Buildbot).
{%- block doctype -%}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{% endblock %}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
{% block head %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{% if metatags %}
{{ metatags }}
{% endif %}
{% if refresh %}
<meta http-equiv="refresh" content="{{ refresh|e }}"/>
{% endif %}
<title></title>
<link rel="stylesheet" href="{{ stylesheet }}" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ path_to_root }}rss">
<link rel="shortcut icon" href="{{ path_to_root }}favicon.ico">
{% endblock %}
</head>
<body class="interface">
{% block header -%}
<div class="header">
{% if authz.authenticated(request) %}
<a href="{{ path_to_root or '.' }}">Home</a>
- <a href="{{ path_to_root }}waterfall">Waterfall</a>
<a href="{{ path_to_root }}grid">Grid</a>
<a href="{{ path_to_root }}tgrid">T-Grid</a>
<a href="{{ path_to_root }}console">Console</a>
<a href="{{ path_to_root }}builders">Builders</a>
<a href="{{ path_to_root }}one_line_per_build">Recent Builds</a>
<a href="{{ path_to_root }}buildslaves">Buildslaves</a>
<a href="{{ path_to_root }}changes">Changesources</a>
{% if authz.advertiseAction('showUsersPage', request) %}
<a href="{{ path_to_root }}users">Users</a>
{% endif %}
- <a href="{{ path_to_root }}json/help">JSON API</a>
- <a href="{{ path_to_root }}about">About</a>
- <a href="{{ path_to_root }}builds">Builds</a>
{% endif %}
<div class="auth">
{% if authz.authenticated(request) %}
{{ authz.getUsernameHTML(request) }}
|<a href="{{ path_to_root }}logout">Logout</a>
{% elif authz.useHttpHeader and authz.httpLoginUrl %}
<a href="{{ authz.httpLoginUrl }}">Login</a>
{% elif authz.auth %}
<form method="post" name="login" action="{{ path_to_root }}login">
<input type="text" name="username" size=10 />
<input type="password" name="passwd" size=10 />
<input type="submit" value="login" />
</form>
{% endif %}
</div>
</div>
{% endblock %}
{% if authz.authenticated(request) %}
{%- block barecontent -%}
{% if alert_msg != "" %}
<div class="alert">
{{ alert_msg }}
</div>
{% endif %}
<div class="content">
{%- block content -%}
{%- endblock -%}
</div>
{%- endblock -%}
{%- block footer -%}
<div class="footer" style="margin-top: 40px;clear:both">
<b>{{ time }}</b> ({{ tz }})
</div>
{% endblock -%}
{% endif %}
</body>
</html>
# -*- python -*-
# ex: set syntax=python:
from buildbot.buildslave import BuildSlave
from buildbot.config import BuilderConfig
from buildbot.changes.gitpoller import GitPoller
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.schedulers import timed
from buildbot.changes import filter
from buildbot.process.factory import BuildFactory
from buildbot.steps.source.git import Git
from buildbot.steps.shell import ShellCommand
from buildbot.steps.master import MasterShellCommand
from buildbot.steps.source.mercurial import Mercurial
from buildbot.steps.transfer import FileUpload
from buildbot.steps.transfer import DirectoryUpload
from buildbot.status import html
from buildbot.status.web import authz, auth
c = BuildmasterConfig = {}
c['slaves'] = [BuildSlave("slave-01", "pass")]
# '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
c['change_source'] = []
#c['change_source'].append(GitPoller('git://github.com/mozilla-b2g/B2G.git', workdir='gitpoller-workdir', branch='master',pollinterval=300))
c['schedulers'] = []
#c['schedulers'].append(timed.Nightly(name='nightly-boot-event', builderNames=['boot-event'], branch='master', hour=4, minute=0))
c['schedulers'].append(ForceScheduler(name='Force-SVIC', builderNames=['mozilla']))
env ={'PATH':'/opt/gcc-4.4.7/bin/:${PATH}'}
f_mozilla = BuildFactory()
# mode=incremental causes BuildBot NOT to remove files from previous builds.
# This allows compiler to take advantage of those files (faster).
f_mozilla.addStep(Git(repourl='git://github.com/mozilla-b2g/B2G.git', mode='incremental'))
f_mozilla.addStep(ShellCommand(env=env, command="echo y | ./config.sh nexus-5", usePTY=True, haltOnFailure=True))
f_mozilla.addStep(ShellCommand(env=env, command="./build.sh", usePTY=True, haltOnFailure=True))
f_mozilla.addStep(ShellCommand(workdir='img', command='rm *', usePTY=True))
f_mozilla.addStep(ShellCommand(workdir='img', command='cp ../build/out/target/product/hammerhead/*.img ./', usePTY=True))
f_mozilla.addStep(ShellCommand(workdir='img', command='bzip2 *.img', usePTY=True))
f_mozilla.addStep(DirectoryUpload(workdir='img', slavesrc='.', masterdest='/root/svic/builds/img'))
f_mozilla.addStep(MasterShellCommand(command='mv /root/svic/builds/img /root/svic/builds/mozilla-$(date +%y-%m-%d-%H:%M)'))
c['builders'] = []
c['builders'].append(BuilderConfig(name='mozilla', slavenames=['slave-01'], factory=f_mozilla))
# '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'] = []
authz_cfg=authz.Authz(
# change any of these to True to enable; see the manual for more
# options
auth=auth.BasicAuth([("svic","koziorozec")]),
gracefulShutdown = False,
forceBuild = True, # use this to test your slave once it is set up
forceAllBuilds = True,
pingBuilder = True,
stopBuild = True,
stopAllBuilds = True,
cancelPendingBuild = True,
)
c['status'].append(html.WebStatus(http_port=2600, authz=authz_cfg))
c['title'] = "B2G"
c['titleURL'] = "http://devnull"
c['buildbotURL'] = "http://localhost:8010/"
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",
}
./stop.sh
buildbot restart master/
buildslave restart slave/
{% extends 'layout.html' %}
{% import 'forms.html' as forms %}
{% block content %}
{% endblock %}
ps ax | grep python | grep -E "buildbot.tac|buildslave" | grep -v grep | awk '{ print $1 }' | xargs kill -9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment