Fix the tag logic.
This commit is contained in:
parent
638dbb3d8d
commit
7a89b0872f
1 changed files with 12 additions and 15 deletions
|
@ -212,22 +212,19 @@ def build_status_badge(namespace, repository):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
# Lookup the tags for the repository.
|
# Lookup the tags for the repository.
|
||||||
|
tags = model.list_repository_tags(namespace, repository)
|
||||||
# Lookup the current/recent build.
|
is_empty = len(list(tags)) == 0
|
||||||
status = 'none'
|
|
||||||
build = model.get_recent_repository_build(namespace, repository)
|
build = model.get_recent_repository_build(namespace, repository)
|
||||||
if build:
|
|
||||||
if build.phase == 'error':
|
|
||||||
status = 'failed'
|
|
||||||
elif build.phase == 'complete':
|
|
||||||
status = 'ready'
|
|
||||||
else:
|
|
||||||
status = 'building'
|
|
||||||
else:
|
|
||||||
tags = model.list_repository_tags(namespace, repository)
|
|
||||||
if list(tags):
|
|
||||||
status = 'ready'
|
|
||||||
|
|
||||||
response = make_response(STATUS_TAGS[status])
|
if not is_empty and (not build or build.phase == 'complete'):
|
||||||
|
status_name = 'ready'
|
||||||
|
elif build and build.phase == 'error':
|
||||||
|
status_name = 'failed'
|
||||||
|
elif build:
|
||||||
|
status_name = 'building'
|
||||||
|
else:
|
||||||
|
status_name = 'none'
|
||||||
|
|
||||||
|
response = make_response(STATUS_TAGS[status_name])
|
||||||
response.content_type = 'image/svg+xml'
|
response.content_type = 'image/svg+xml'
|
||||||
return response
|
return response
|
||||||
|
|
Reference in a new issue