mirror of
https://github.com/lubuntu-team/lugito.git
synced 2025-05-01 21:11:28 +00:00
Make IRC messages more granular, and don't forget to return Ok.
This commit is contained in:
parent
9b4358ed98
commit
935867aa7e
@ -123,14 +123,50 @@ class jenkins(object):
|
|||||||
if not proj:
|
if not proj:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
# Return the status of the last completed build
|
# Get the status of the last completed build if there isone
|
||||||
try:
|
try:
|
||||||
|
# Get the data from Jenkins
|
||||||
status = proj[1].get_last_completed_build().get_status()
|
status = proj[1].get_last_completed_build().get_status()
|
||||||
url = proj[1].get_last_completed_build().get_build_url()
|
url = proj[1].get_last_completed_build().get_build_url()
|
||||||
return proj[0], status, url
|
|
||||||
except jenkinsapi.custom_exceptions.NoBuildData:
|
except jenkinsapi.custom_exceptions.NoBuildData:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Get the status of <current build> - 1
|
||||||
|
last_status = proj[1].get_build(proj[1].get_last_buildnumber() - 1)
|
||||||
|
last_status = last_status.get_status()
|
||||||
|
|
||||||
|
# If it has been consistently stable, don't cause extra noise
|
||||||
|
if status == "SUCCESS" and last_status == status:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Customize the message depending on the previous build status
|
||||||
|
if status == "SUCCESS":
|
||||||
|
if last_status == "FAILURE":
|
||||||
|
status = "just succeeded after failing"
|
||||||
|
elif last_status == "UNSTABLE":
|
||||||
|
status = "just became stable"
|
||||||
|
# Color it green
|
||||||
|
status = "\x033" + status + "\x03"
|
||||||
|
elif status == "FAILURE":
|
||||||
|
if last_status == "SUCCESS":
|
||||||
|
status = "just failed after succeeding"
|
||||||
|
elif last_status == "UNSTABLE":
|
||||||
|
status = "just failed after being unstable"
|
||||||
|
# Color it red
|
||||||
|
status = "\x034" + status + "\x03"
|
||||||
|
elif status == "UNSTABLE":
|
||||||
|
if last_status == "SUCCESS":
|
||||||
|
status = "just became unstable"
|
||||||
|
elif last_status == "FAILURE":
|
||||||
|
status = "just became unstable after failing"
|
||||||
|
# Color it yellow
|
||||||
|
status = "\x038" + status + "\x03"
|
||||||
|
elif status == "ABORTED":
|
||||||
|
# Color it gray
|
||||||
|
status = "\x0315" + status + "\x03"
|
||||||
|
|
||||||
|
return proj[0], status, url
|
||||||
|
|
||||||
|
|
||||||
def listen(self):
|
def listen(self):
|
||||||
pass
|
pass
|
||||||
|
@ -199,6 +199,8 @@ def jenkinsircnotify():
|
|||||||
if status:
|
if status:
|
||||||
irc_con.send("Lubuntu CI", proj, status, link)
|
irc_con.send("Lubuntu CI", proj, status, link)
|
||||||
|
|
||||||
|
return 'Ok'
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
irc_con.connect()
|
irc_con.connect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user