blob: 609d6b5c44b1e575e4d2c1cd500571e83a23586c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/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.sh' % trigger_name]
for arg in args: trigger_cmd.append(arg)
return subprocess.call(trigger_cmd)
@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='0.0.0.0', port=8080, debug=True)
|