From 6840c17b34fe277045388d53149880a7d1705ae8 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 27 Sep 2016 12:40:05 +0200 Subject: [PATCH 1/9] update guanlecoja-ui 1.6.2 Allows to fix responsive UI bug http://trac.buildbot.net/ticket/3614 https://github.com/buildbot/guanlecoja-ui/pull/6 --- www/base/guanlecoja/config.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/base/guanlecoja/config.coffee b/www/base/guanlecoja/config.coffee index c7e7a90b598..b6b877adb0f 100644 --- a/www/base/guanlecoja/config.coffee +++ b/www/base/guanlecoja/config.coffee @@ -30,7 +30,7 @@ config = # JavaScript libraries (order matters) deps: "guanlecoja-ui": - version: '~1.6.1' + version: '~1.6.2' files: ['vendors.js', 'scripts.js'] moment: version: "~2.6.0" From 52423c35e889020a05b85b52bc950136e535f0d1 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Mon, 26 Sep 2016 17:06:34 +0200 Subject: [PATCH 2/9] document actions in the REST api document they were documented in the raml, but not converted to rst --- master/buildbot/test/unit/test_util_raml.py | 5 +++++ master/buildbot/util/raml.py | 10 ++++++++++ master/docs/bbdocs/ext.py | 16 ++++++++++++++-- master/docs/developer/rest.rst | 21 ++++++++++++++++----- master/docs/indices.rst | 1 + 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/master/buildbot/test/unit/test_util_raml.py b/master/buildbot/test/unit/test_util_raml.py index 642a488cf1c..187302c6569 100644 --- a/master/buildbot/test/unit/test_util_raml.py +++ b/master/buildbot/test/unit/test_util_raml.py @@ -76,3 +76,8 @@ def test_endpoints_by_type(self): self.assertIn( "/masters/{masterid}/builders/{builderid}/workers/{workerid}", self.api.endpoints_by_type['worker'].keys()) + + def test_iter_actions(self): + build = self.api.endpoints_by_type['build'] + actions = dict(self.api.iter_actions(build['/builds/{buildid}'])) + self.assertEqual(sorted(actions.keys()), sorted(['rebuild', 'stop'])) diff --git a/master/buildbot/util/raml.py b/master/buildbot/util/raml.py index 853c31ddd87..20443279e69 100644 --- a/master/buildbot/util/raml.py +++ b/master/buildbot/util/raml.py @@ -77,3 +77,13 @@ def format_json(self, j, indent): def parse_types(self): types = self.api['types'] return types + + def iter_actions(self, endpoint): + ACTIONS_MAGIC = '/actions/' + for k, v in endpoint.iteritems(): + if k.startswith(ACTIONS_MAGIC): + k = k[len(ACTIONS_MAGIC):] + v = v['post'] + # simplify the raml tree for easier processing + v['body'] = v['body']['application/json'].get('properties', {}) + yield (k, v) diff --git a/master/docs/bbdocs/ext.py b/master/docs/bbdocs/ext.py index fad6ead8e10..9d5540c5102 100644 --- a/master/docs/bbdocs/ext.py +++ b/master/docs/bbdocs/ext.py @@ -269,6 +269,17 @@ class BBDomain(Domain): names=('pathkey',), typenames=('type',), can_collapse=True), ]), + 'raction': make_ref_target_directive('raction', + indextemplates=[ + 'single: Resource Action; %s', + ], + name_annotation='POST with method:', + has_content=True, + doc_field_types=[ + TypedField('body', label='Body keys', + names=('body',), typenames=('type',), + can_collapse=True), + ]), } roles = { @@ -300,8 +311,9 @@ class BBDomain(Domain): make_index("cmdline", "Command Line Index"), make_index("msg", "MQ Routing Key Index"), make_index("event", "Data API Event Index"), - make_index("rtype", "Data API Resource Type Index"), - make_index("rpath", "Data API Path Index"), + make_index("rtype", "REST/Data API Resource Type Index"), + make_index("rpath", "REST/Data API Path Index"), + make_index("raction", "REST/Data API Actions Index"), ] def resolve_xref(self, env, fromdocname, builder, typ, target, node, diff --git a/master/docs/developer/rest.rst b/master/docs/developer/rest.rst index 4127be96abc..f43c4727427 100644 --- a/master/docs/developer/rest.rst +++ b/master/docs/developer/rest.rst @@ -211,7 +211,7 @@ RAML describes and documents all our data, rest, and javascript APIs in a format {{type.description}} {% endif %} - {% if name in raml.endpoints_by_type -%} + {% if name in raml.endpoints_by_type -%}{# if type has endpoints #} Endpoints --------- {% for ep, config in raml.endpoints_by_type[name].items()|sort -%} @@ -230,7 +230,18 @@ RAML describes and documents all our data, rest, and javascript APIs in a format :bb:rtype:`collection` of :bb:rtype:`{{method_ep['eptype']}}` {% endif %} - {% endif %} - {% endfor %} - {% endif %} - {% endfor %} + {% endif %}{# if ep has get #} + + {% for method, action in raml.iter_actions(config) -%} + .. bb:raction:: {{ep}}:{{method}} + + :body string method: must be ``{{ method }}`` + + {% for key, value in action['body'].items() -%} + :body {{value.type}} {{key}}: {{raml.reindent(value.description, 4*2)}} + {% endfor %} + + {% endfor %}{# endpoints #} + {% endfor %}{# endpoints #} + {% endif %}{# if type has endpoints #} + {% endfor %}{# for each types #} diff --git a/master/docs/indices.rst b/master/docs/indices.rst index db1ca6ce212..fc250685a36 100644 --- a/master/docs/indices.rst +++ b/master/docs/indices.rst @@ -12,5 +12,6 @@ Indices and Tables * :bb:index:`event` * :bb:index:`rtype` * :bb:index:`rpath` +* :bb:index:`raction` * :ref:`modindex` * :ref:`search` From befcae9febe8e599bdd9ce666a891b2f694d5a9b Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 27 Sep 2016 10:26:00 +0200 Subject: [PATCH 3/9] fix table of contents --- master/docs/developer/rest.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/master/docs/developer/rest.rst b/master/docs/developer/rest.rst index f43c4727427..6364eb86a6c 100644 --- a/master/docs/developer/rest.rst +++ b/master/docs/developer/rest.rst @@ -14,6 +14,8 @@ It is also designed, in keeping with REST principles, to be discoverable. As such, the details of the paths and resources are not documented here. Begin at the root URL, and see the :ref:`Data_API` documentation for more information. +.. contents:: :local: + Versions ~~~~~~~~ @@ -168,9 +170,6 @@ Raml Specs The Data API is documented in `RAML 1.0 format `_. RAML describes and documents all our data, rest, and javascript APIs in a format that can be easily manipulated by human and machines. -.. toctree:: - :maxdepth: 2 - .. jinja:: data_api {% for name, type in raml.types.items()|sort %} From bb36bbfd71c69fa1423f4e99a7fb44c082a974c1 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 27 Sep 2016 10:48:17 +0200 Subject: [PATCH 4/9] add rawraml display --- master/buildbot/util/raml.py | 7 +++++-- master/docs/developer/rest.rst | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/master/buildbot/util/raml.py b/master/buildbot/util/raml.py index 20443279e69..dd6177297b5 100644 --- a/master/buildbot/util/raml.py +++ b/master/buildbot/util/raml.py @@ -38,8 +38,11 @@ def __init__(self): # waiting for raml1.0 support in ramlfications # we cannot use its raml parser # so we just use its loader - self.api = ramlfications.load(os.path.join( - os.path.dirname(__file__), os.pardir, 'spec', 'api.raml')) + fn = os.path.join(os.path.dirname(__file__), os.pardir, 'spec', 'api.raml') + self.api = ramlfications.load(fn) + with open(fn) as f: + self.rawraml = f.read() + endpoints = {} self.endpoints_by_type = {} self.endpoints = self.parse_endpoints(endpoints, "", self.api) diff --git a/master/docs/developer/rest.rst b/master/docs/developer/rest.rst index 6364eb86a6c..6da8101f279 100644 --- a/master/docs/developer/rest.rst +++ b/master/docs/developer/rest.rst @@ -244,3 +244,30 @@ RAML describes and documents all our data, rest, and javascript APIs in a format {% endfor %}{# endpoints #} {% endif %}{# if type has endpoints #} {% endfor %}{# for each types #} + + Raw endpoints + ............. + + Raw endpoints allow to download content in their raw format (i.e. not within a json glue). + The ``content-disposition`` http header is set, so that the browser knows which file to store the content to. + + {% for ep, config in raml.rawendpoints.items()|sort %} + + .. bb:rpath:: {{ep}} + + {% for key, value in config.uriParameters.items() -%} + :pathkey {{value.type}} {{key}}: {{raml.reindent(value.description, 4*2)}} + {% endfor %} + + {{config['get'].description}} + + {% endfor %} + + Raml spec verbatim + .................. + + Sometimes raml is just clearer than formatted text. + + .. code-block:: yaml + + {{raml.reindent(raml.rawraml, 4*1)}} From 19325dcb63f4227e3c6f862ca2189959ddcd9d1d Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 27 Sep 2016 12:58:06 +0200 Subject: [PATCH 5/9] fix spelling --- master/buildbot/spec/api.raml | 2 +- master/docs/developer/rest.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/master/buildbot/spec/api.raml b/master/buildbot/spec/api.raml index 84f0bb7e40a..6b8987c37b2 100644 --- a/master/buildbot/spec/api.raml +++ b/master/buildbot/spec/api.raml @@ -164,7 +164,7 @@ types: This endpoint does not provide paging capabilities. For stream log types, the type line header characters are dropped. 'text/plain' is used as the mime type except for html logs, where 'text/html' is used. - The 'slug' is used as the filename for the resulting download. Some browsers are appending ".txt" or ".html" to this filename according to the mime-type. + The 'slug' is used as the filename for the resulting download. Some browsers are appending ``".txt"`` or ``".html"`` to this filename according to the mime-type. is: - bbgetraw: diff --git a/master/docs/developer/rest.rst b/master/docs/developer/rest.rst index 6da8101f279..c33bea65544 100644 --- a/master/docs/developer/rest.rst +++ b/master/docs/developer/rest.rst @@ -266,7 +266,7 @@ RAML describes and documents all our data, rest, and javascript APIs in a format Raml spec verbatim .................. - Sometimes raml is just clearer than formatted text. + Sometimes Raml is just clearer than formatted text. .. code-block:: yaml From c3f1f624404f3904b25b0a900e0c2508a648f6a9 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 27 Sep 2016 12:52:33 +0200 Subject: [PATCH 6/9] update relnotes --- master/docs/relnotes/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/master/docs/relnotes/index.rst b/master/docs/relnotes/index.rst index 933babd26df..6d8dc5543a3 100644 --- a/master/docs/relnotes/index.rst +++ b/master/docs/relnotes/index.rst @@ -28,6 +28,8 @@ Features Fixes ~~~~~ +* Fix the UI to better adapt to different screen width (:bug:`3614`) + Changes for Developers ~~~~~~~~~~~~~~~~~~~~~~ From 45f34aa039d832c04c123d1cbb9b097d462b07a0 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 27 Sep 2016 10:16:34 +0200 Subject: [PATCH 7/9] parse rawendpoints --- master/buildbot/test/unit/test_util_raml.py | 5 +++++ master/buildbot/util/raml.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/master/buildbot/test/unit/test_util_raml.py b/master/buildbot/test/unit/test_util_raml.py index 187302c6569..437dc3d75b9 100644 --- a/master/buildbot/test/unit/test_util_raml.py +++ b/master/buildbot/test/unit/test_util_raml.py @@ -81,3 +81,8 @@ def test_iter_actions(self): build = self.api.endpoints_by_type['build'] actions = dict(self.api.iter_actions(build['/builds/{buildid}'])) self.assertEqual(sorted(actions.keys()), sorted(['rebuild', 'stop'])) + + def test_rawendpoints(self): + self.assertIn( + "/steps/{stepid}/logs/{log_slug}/raw", + self.api.rawendpoints.keys()) diff --git a/master/buildbot/util/raml.py b/master/buildbot/util/raml.py index dd6177297b5..390bfa57487 100644 --- a/master/buildbot/util/raml.py +++ b/master/buildbot/util/raml.py @@ -45,6 +45,7 @@ def __init__(self): endpoints = {} self.endpoints_by_type = {} + self.rawendpoints = {} self.endpoints = self.parse_endpoints(endpoints, "", self.api) self.types = self.parse_types() @@ -68,6 +69,9 @@ def parse_endpoints(self, endpoints, base, api, uriParameters=None): v['eptype'] = _is['bbget']['bbtype'] self.endpoints_by_type.setdefault(v['eptype'], {}) self.endpoints_by_type[v['eptype']][base] = api + if 'bbgetraw' in _is: + self.rawendpoints.setdefault(base, {}) + self.rawendpoints[base] = api return endpoints def reindent(self, s, indent): From 9a7850f2437306e0a3a1ce65bff3eec98247be79 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Wed, 28 Sep 2016 13:34:45 +0200 Subject: [PATCH 8/9] relnotes for rc4 --- master/docs/relnotes/0.9.0rc4.rst | 29 +++++++++++++++++++++++++++++ master/docs/relnotes/index.rst | 5 ++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 master/docs/relnotes/0.9.0rc4.rst diff --git a/master/docs/relnotes/0.9.0rc4.rst b/master/docs/relnotes/0.9.0rc4.rst new file mode 100644 index 00000000000..c894b8fece9 --- /dev/null +++ b/master/docs/relnotes/0.9.0rc4.rst @@ -0,0 +1,29 @@ +Release Notes for Buildbot ``0.9.0rc3`` +======================================== + + +The following are the release notes for Buildbot ``0.9.0rc4``. +This version was released on September 28, 2016. + +See :ref:`Upgrading to Nine` for a guide to upgrading from 0.8.x to 0.9.x + + +Master +------ + +Fixes +~~~~~ + +* Fix the UI to better adapt to different screen width (:bug:`3614`) + +* Add more REST api documentation (document ``/raw`` endpoints, and ``POST`` actions) + + +Details +------- + +For a more detailed description of the changes made in this version, see the git log itself: + +.. code-block:: bash + + git log v0.9.0rc3..v0.9.0rc4 diff --git a/master/docs/relnotes/index.rst b/master/docs/relnotes/index.rst index 6d8dc5543a3..83cc1f98452 100644 --- a/master/docs/relnotes/index.rst +++ b/master/docs/relnotes/index.rst @@ -28,8 +28,6 @@ Features Fixes ~~~~~ -* Fix the UI to better adapt to different screen width (:bug:`3614`) - Changes for Developers ~~~~~~~~~~~~~~~~~~~~~~ @@ -62,7 +60,7 @@ For a more detailed description of the changes made in this version, see the git .. code-block:: bash - git log v0.9.0rc3..master + git log v0.9.0rc4..master Older Versions -------------- @@ -74,6 +72,7 @@ Newer versions are also available here: :maxdepth: 1 0.9.0 + 0.9.0rc4 0.9.0rc3 0.9.0rc2 0.9.0rc1 From 845025c8dacb20eaf87fc2727824555f1b089a0d Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Wed, 28 Sep 2016 15:03:08 +0200 Subject: [PATCH 9/9] rc4! --- master/docs/relnotes/0.9.0rc4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/docs/relnotes/0.9.0rc4.rst b/master/docs/relnotes/0.9.0rc4.rst index c894b8fece9..ce0b5b60375 100644 --- a/master/docs/relnotes/0.9.0rc4.rst +++ b/master/docs/relnotes/0.9.0rc4.rst @@ -1,4 +1,4 @@ -Release Notes for Buildbot ``0.9.0rc3`` +Release Notes for Buildbot ``0.9.0rc4`` ========================================