Skip to content

Commit

Permalink
fix review comments, and last unit test issues
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
  • Loading branch information
Pierre Tardy committed Mar 8, 2014
1 parent 83a0392 commit 67c0967
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
2 changes: 2 additions & 0 deletions master/buildbot/data/properties.py
Expand Up @@ -36,6 +36,8 @@ class BuildPropertiesEndpoint(base.Endpoint):
"""

def get(self, resultSpec, kwargs):
# its not really implemented db.getBuildProperties is TBD
# this code is kept here as a placeholder (so its not yet documented)
return self.master.db.builds.getBuildProperties(kwargs['buildid'])


Expand Down
11 changes: 10 additions & 1 deletion master/buildbot/data/steps.py
Expand Up @@ -99,6 +99,11 @@ def startConsuming(self, callback, options, kwargs):
raise NotImplementedError("cannot consume from this path")


class UrlType(types.Entity):
name = types.String()
url = types.String()


class Step(base.ResourceType):

name = "step"
Expand All @@ -121,7 +126,11 @@ class EntityType(types.Entity):
complete_at = types.NoneOk(types.DateTime())
results = types.NoneOk(types.Integer())
state_strings = types.List(of=types.String())
urls = types.List(of=types.String())
urls = types.List(
of=types.Dict(
name=types.String(),
url=types.String()
))
link = types.Link()
entityType = EntityType(name)

Expand Down
3 changes: 2 additions & 1 deletion master/buildbot/db/steps.py
Expand Up @@ -131,8 +131,9 @@ def addURL(self, stepid, name, url, _racehook=None):
# at the end of a step)
# this race condition is only inside the same master, as only one master
# is supposed to add urls to a buildstep.
# so threading.lock is used, as we are in the thread poll
# so threading.lock is used, as we are in the thread pool
if self.url_lock is None:
# this runs in reactor thread, so no race here..
self.url_lock = defer.DeferredLock()

def thd(conn):
Expand Down
4 changes: 3 additions & 1 deletion master/buildbot/process/buildstep.py
Expand Up @@ -351,7 +351,9 @@ def setProgress(self, metric, value):

@defer.inlineCallbacks
def setStateStrings(self, strings):
yield self.master.data.updates.setStepStateStrings(self.stepid, map(unicode,strings))
# we render the strings with properties first
strings = yield self.build.render(strings)
yield self.master.data.updates.setStepStateStrings(self.stepid, map(unicode, strings))
# call to the status API for now
self.step_status.old_setText(strings)
self.step_status.old_setText2(strings)
Expand Down
12 changes: 11 additions & 1 deletion master/docs/developer/database.rst
Expand Up @@ -335,7 +335,7 @@ steps
* ``complete_at`` (datetime at which this step finished, or None if it is ongoing)
* ``state_strings`` (list of short strings describing the step's state)
* ``results`` (results of this step; see :ref:`Build-Result-Codes`)
* ``urls`` (list of URLs produced by this step)
* ``urls`` (list of URLs produced by this step. Each urls is stored as a dictionary with keys `name` and `url`)

.. py:method:: getStep(stepid=None, buildid=None, number=None, name=None)
Expand Down Expand Up @@ -391,6 +391,16 @@ steps

This update is done unconditionally, even if the steps are already finished.

.. py:method:: addURL(self, stepid, name, url)
:param integer stepid: the stepid to add the url.
:param string name: the url name
:param string url: the actual url
:returns: None via deferred

Add a new url to a step.
The new url is added to the list of urls.

logs
~~~~

Expand Down
12 changes: 11 additions & 1 deletion master/docs/developer/rtype-step.rst
Expand Up @@ -16,7 +16,7 @@ Steps
:attr list state_strings: a list of strings giving progressively more detail on the state of the build.
The first is usually one word or phrase; the remainder are sized for one-line display.
:attr urls: a list of URLs associated with this step.
:type urls: list of strings
:type urls: list of dictionaries with keys `name` and `url`
:attr Link link: link for this step

This resource type describes a step in a build.
Expand Down Expand Up @@ -102,6 +102,16 @@ All update methods are available as attributes of ``master.data.updates``.

Replace the existing state strings for a step with a new list.

.. py:method:: addStepURL(stepid, name, url):
:param integer stepid: the step to modify
:param string name: the url name
:param string url: the actual url
:returns: None via deferred

Add a new url to a step.
The new url is added to the list of urls.

.. py:method:: finishStep(stepid, results)
:param integer stepid: the step to modify
Expand Down

0 comments on commit 67c0967

Please sign in to comment.