From ffece483e11075b20dc6bf0b691aa636d25092a6 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 5 Nov 2017 14:59:31 +0100 Subject: Add: GET /projects/foo/builds --- ick2/controllerapi.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ick2/controllerapi.py') diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py index 63daa94..4f2872b 100644 --- a/ick2/controllerapi.py +++ b/ick2/controllerapi.py @@ -231,12 +231,18 @@ class ProjectAPI(ResourceApiBase): def get_pipeline_routes(self, path): # pragma: no cover pipeline_path = '{}//pipelines/'.format(path) + builds_path = '{}//builds'.format(path) return [ { 'method': 'GET', 'path': pipeline_path, 'callback': self.GET(self.get_pipeline), }, + { + 'method': 'GET', + 'path': builds_path, + 'callback': self.GET(self.get_builds), + }, ] def get_pipeline(self, project, pipeline): @@ -248,6 +254,13 @@ class ProjectAPI(ResourceApiBase): } raise ick2.NotFound() + def get_builds(self, project): + p = self._state.get_resource(self._type_name, project) + return { + 'project': project, + 'builds': p.get('builds', []), + } + def response(status_code, body, headers): # pragma: no cover obj = { -- cgit v1.2.1