Skip to content

Commit

Permalink
Badges: Add 'running' status
Browse files Browse the repository at this point in the history
  • Loading branch information
minextu committed Dec 15, 2017
1 parent f2b4552 commit 281e6d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions www/badges/buildbot_badges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Api(object):
"exception": "#007ec6", # blue
"failure": "#e05d44", # red
"retry": "#007ec6", # blue
"running": "#007ec6", # blue
"skipped": "a4a61d", # yellowgreen
"success": "#4c1", # brightgreen
"unknown": "#9f9f9f", # lightgrey
Expand Down Expand Up @@ -85,17 +86,19 @@ def getSvg(self, request, builder):
request.setHeader('content-type', 'image/svg+xml')
request.setHeader('cache-control', 'no-cache')

# get the last completed build for that builder using the data api
# get the last build for that builder using the data api
last_build = yield self.ep.master.data.get(
("builders", builder, "builds"),
limit=1, order=['-number'],
filters=[resultspec.Filter('complete', 'eq', [True])])
limit=1, order=['-number'])

# get the status text corresponding to results code
results_txt = "unknown"
if last_build:
results = last_build[0]['results']
if results >= 0 and results < len(Results):
complete = last_build[0]['complete']
if not complete:
results_txt = "running"
elif results >= 0 and results < len(Results):
results_txt = Results[results]

svgdata = self.makesvg(results_txt, results_txt, left_text=config['left_text'], config=config)
Expand Down

0 comments on commit 281e6d7

Please sign in to comment.