summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.sh5
-rw-r--r--source/bottlerock.py42
-rw-r--r--source/build_complete.sh12
-rw-r--r--source/definitions_update.sh12
-rw-r--r--source/repo_update.sh12
-rw-r--r--start.sh2
6 files changed, 85 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh
index c68e1d5..ac159db 100644
--- a/setup.sh
+++ b/setup.sh
@@ -12,3 +12,8 @@ virtualenv --no-site-packages orchenv-slave
cd orchenv-slave
./bin/pip install buildbot-slave
./bin/buildslave create-slave -r slave localhost:9989 example-slave pass
+# setup bottlerock
+cd ..
+virtualenv --no-site-packages bottlerock
+cd bottlerock
+./bin/pip install buildbot bottle
diff --git a/source/bottlerock.py b/source/bottlerock.py
new file mode 100644
index 0000000..9b7915f
--- /dev/null
+++ b/source/bottlerock.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python2.7
+
+# This script provides an interface for sandboxed code to trigger buildbot
+# using plain HTTP
+
+from bottle import post, request, run, HTTPResponse
+
+trigger_names = [
+ 'repo_update',
+ 'definitions_update',
+ 'build_complete']
+
+def call_trigger(trigger_name,*args):
+ global trigger_names
+ assert trigger_name in trigger_names
+ import subprocess
+ trigger_cmd = ['sh','source/%s' % trigger_name]
+ for arg in args: trigger_cmd.append(arg)
+ trigger_ballback = subprocess.Popen(trigger_cmd)
+ return trigger_callback.wait()
+
+@post('/repo_update')
+def repo_update():
+ repo_name = request.forms.get("repo_name")
+ if not repo_name:
+ return HTTPResponse(
+ status=400,
+ body="400: A repo_name is required")
+ if call_trigger('repo_update',repo_name):
+ return HTTPResponse(status=500)
+ return 0
+
+@post('/definitions_update')
+def definitions_update():
+ pass
+
+@post('/build_complete')
+def repo_update():
+ pass
+
+if __name__ == '__main__':
+ run(host='localhost', port=8080, debug=True)
diff --git a/source/build_complete.sh b/source/build_complete.sh
new file mode 100644
index 0000000..9d217b7
--- /dev/null
+++ b/source/build_complete.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# this will run once ybd has finished a build
+set -e
+
+category=postbuild
+
+IP=127.0.0.1
+port=9999
+user=orchestration
+passwd=orchestration
+
+orchenv-master/bin/buildbot --verbose sendchange -m "$IP":"$port" -a "$user":"$passwd" -W scriptbot -C "$category" -F sendlog
diff --git a/source/definitions_update.sh b/source/definitions_update.sh
new file mode 100644
index 0000000..f77b175
--- /dev/null
+++ b/source/definitions_update.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# this will go on the definitions post-receive hook
+set -e
+
+category=definitions
+
+IP=127.0.0.1
+port=9999
+user=orchestration
+passwd=orchestration
+
+buildbot sendchange -m "$IP":"$port" -a "$user":"$passwd" -W scriptbot -C "$category"
diff --git a/source/repo_update.sh b/source/repo_update.sh
new file mode 100644
index 0000000..4cbe4d3
--- /dev/null
+++ b/source/repo_update.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# this will go on the post-receive hooks for repos updated by lorry
+set -e
+
+category=lorry
+
+IP=127.0.0.1
+port=9999
+user=orchestration
+passwd=orchestration
+
+buildbot sendchange -m "$IP":"$port" -a "$user":"$passwd" -W scriptbot -C "$category"
diff --git a/start.sh b/start.sh
index c09094b..7cd630a 100644
--- a/start.sh
+++ b/start.sh
@@ -4,3 +4,5 @@ cd orchenv-master
./bin/buildbot start master
cd ../orchenv-slave
./bin/buildslave start slave
+cd ../bottlerock
+./bin/python2.7 ../source/bottlerock.py