Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Merge pull request #357 from Unity-Technologies/CDSK-919-friendly_nam…
Browse files Browse the repository at this point in the history
…e-in-MyBuilds

CDSK-919 - add friendly_name to MyBuilds & MyBuildsJsonResource
  • Loading branch information
warcholprzemo committed Apr 30, 2018
2 parents b126dfb + ec404f6 commit 4e81a45
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
37 changes: 20 additions & 17 deletions master/buildbot/db/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,26 @@ def thd(conn):

res = conn.execute(q)

return [self._minimal_bdict(row, botmaster) for row in res.fetchall()]
last_builds = []
for row in res.fetchall():
buildername = row.buildrequests_buildername
last_builds.append(dict(
buildername=buildername,
friendly_name=botmaster.master.status.getFriendlyName(buildername) or buildername,
complete=bool(row.buildrequests_complete),
builds_id=row.builds_id,
builds_number=row.builds_number,
reason=row.buildsets_reason,
project=botmaster.getBuilderConfig(row.buildrequests_buildername).project,
slavename=row.builds_slavename,
submitted_at=mkdt(row.buildrequests_submitted_at),
complete_at=mkdt(row.buildrequests_complete_at),
sourcestampsetid=row.buildsets_sourcestampsetid,
results=row.buildrequests_results,
))
return last_builds


return self.db.pool.do(thd)

def createFullBuildObject(self, branch, revision, repository, project, reason, submitted_at,
Expand Down Expand Up @@ -402,19 +421,3 @@ def mkdt(epoch):
if 'results' in row.keys():
_bdict['results'] = row.results
return _bdict

@staticmethod
def _minimal_bdict(row, botmaster):
return dict(
buildername=row.buildrequests_buildername,
complete=bool(row.buildrequests_complete),
builds_id=row.builds_id,
builds_number=row.builds_number,
reason=row.buildsets_reason,
project=botmaster.getBuilderConfig(row.buildrequests_buildername).project,
slavename=row.builds_slavename,
submitted_at=mkdt(row.buildrequests_submitted_at),
complete_at=mkdt(row.buildrequests_complete_at),
sourcestampsetid=row.buildsets_sourcestampsetid,
results=row.buildrequests_results,
)
3 changes: 3 additions & 0 deletions master/buildbot/test/fake/fakemaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def builderAdded(self, name, basedir, category=None, friendly_name=None, descrip
def build_started(self, brid, buildername, build_status):
pass

def getFriendlyName(self, name):
return name


class FakeBuildRequestMerger(object):

Expand Down
2 changes: 2 additions & 0 deletions master/buildbot/test/unit/test_util_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_mocked_status(self):
def test_merge_sourcestamps_to_build(self):
builds_by_ssid = {69: {
'buildername': u'Elementary Test',
'friendly_name': "Friendly Elementary Test",
'builds_id': 131,
'builds_number': 4,
'complete': True,
Expand Down Expand Up @@ -63,6 +64,7 @@ def test_merge_sourcestamps_to_build(self):

expected_data = [{
'buildername': u'Elementary Test',
'friendly_name': "Friendly Elementary Test",
'builds_id': 131,
'builds_number': 4,
'complete': True,
Expand Down
2 changes: 1 addition & 1 deletion www/templates/mybuilds.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h2>Your builds run in last {% if days_count <= 1 %}day{% else %}{{ days_count }
</ul>
</td>
<td>
{{ build.buildername }}
{{ build.friendly_name }}
</td>
<td class="{{ build.result_css_class }} initialism" title="{{ build.result_name }} ({{ build.results }})">
{{ build.result_name }}
Expand Down

0 comments on commit 4e81a45

Please sign in to comment.