summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lwirzenius@wikimedia.org>2019-07-23 19:58:07 +0300
committerLars Wirzenius <lwirzenius@wikimedia.org>2019-07-23 19:58:07 +0300
commit047c2aca245805746cee3af9f2588373b1602500 (patch)
tree056d1314459063de502ecb06c09e8f3414bddfb2
parentfa5003d1f29bf0d6886dbf6a10a09f3440876b15 (diff)
downloadwmf-ci-arch-047c2aca245805746cee3af9f2588373b1602500.tar.gz
Change: track build status
-rwxr-xr-xapi.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/api.py b/api.py
index ddbefe2..81f644e 100755
--- a/api.py
+++ b/api.py
@@ -404,7 +404,7 @@ class Controller(API):
def __init__(self, token):
super().__init__()
self._token = token
- self._builds = []
+ self._builds = {}
def get_routes(self):
return [
@@ -430,7 +430,7 @@ class Controller(API):
def _status(self):
return {
- 'builds': list(self._builds),
+ 'builds': {name: self._builds[name] for name in sorted(self._builds)},
}
def _trigger(self):
@@ -441,8 +441,13 @@ class Controller(API):
logging.debug('Request: %r', bottle.request.body.read())
raise bottle.HTTPError(400)
- logging.info('Triggering build of %r', spec)
- self._builds.append(spec)
+ name = spec.get('gitlab')
+ if name is None:
+ logging.error('Request spec has no gitlab')
+ raise bottle.HTTPError(400)
+
+ logging.info('Triggering build of %s', name)
+ self._builds[name] = None
url = '{}/updaterepo'.format(self.VCSWORKER)
argv = [
@@ -466,6 +471,7 @@ class Controller(API):
if kind == 'build' and r is not None:
name = r.get('name')
logging.info('Repository %s build status %s', name, status)
+ self._builds[name] = status