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

Commit

Permalink
Add icons to the changesbot build results
Browse files Browse the repository at this point in the history
Summary: Draw attention to whether a diff passed/failed by including icons

Test Plan: Ran unit test, will test after deploying

Reviewers: vishal, kylec, ar

Reviewed By: ar

Subscribers: alexallain, changesbot

Differential Revision: https://tails.corp.dropbox.com/D91789
  • Loading branch information
Willy Wu committed Feb 25, 2015
1 parent 144dde5 commit 010993b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion changes/listeners/phabricator_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from flask import current_app

from changes.config import db
from changes.constants import Result
from changes.models import Build, ProjectOption
from changes.utils.http import build_uri

Expand Down Expand Up @@ -88,7 +89,16 @@ def build_finished_handler(build_id, **kwargs):
if options.get('phabricator.notify', '0') != '1':
return

message = u'Build {result} - {project} #{number} ({target}). Build Results: [link]({link})'.format(
result_image = ''
if build.result == Result.passed:
result_image = 'green-check'
elif build.result == Result.failed:
result_image = 'red-x'
else:
result_image = 'yellow-question'

message = u'{image}\nBuild {result} - {project} #{number} ({target}). Build Results: [link]({link})'.format(
image=result_image,
number='{0}'.format(build.number),
result=unicode(build.result),
target=build.target or build.source.revision_sha or 'Unknown',
Expand Down
2 changes: 1 addition & 1 deletion tests/changes/listeners/test_phabricator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_whitelisted_project(self, get_options, phab):
get_options.assert_called_once_with(project.id)
build_link = build_uri('/projects/{0}/builds/{1}/'.format(
build.project.slug, build.id.hex))
expected_msg = "Build Failed - test #1 (D1). Build Results: [link]({0})".format(
expected_msg = "red-x\nBuild Failed - test #1 (D1). Build Results: [link]({0})".format(
build_link)

phab.assert_called_once_with('1', expected_msg)

0 comments on commit 010993b

Please sign in to comment.