From 84205b51356939a2f6131b907694b975e6dc8c44 Mon Sep 17 00:00:00 2001 From: Tommy Ziegler Date: Thu, 17 Jul 2014 23:50:37 +0200 Subject: [PATCH] Fixing problems with current jenkins version * Fixed certain small issues ** Check for FINISHED or FINALIZED phase ** Use job_url to find lastFailedBuild, because a job name can contain blanks ** Look for the correct username (in case we use authentication '/user/' finds the logged in user and not the commited by user name) --- retaliation.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/retaliation.py b/retaliation.py index 763c829..571ef42 100755 --- a/retaliation.py +++ b/retaliation.py @@ -288,15 +288,15 @@ def read_url(url): return urllib2.urlopen(request).read() -def jenkins_get_responsible_user(job_name): +def jenkins_get_responsible_user(job_url): # Call back to Jenkins and determin who broke the build. (Hacky) # We do this by crudly parsing the changes on the last failed build - changes_url = JENKINS_SERVER + "/job/" + job_name + "/lastFailedBuild/changes" + changes_url = JENKINS_SERVER + "/" + job_url + "lastFailedBuild/changes" changedata = read_url(changes_url) # Look for the /user/[name] link - m = re.compile('/user/([^/"]+)').search(changedata) + m = re.compile('by