Merge lp:~fgiff/linaro-android-bot-review/ignore-dead-builds into lp:linaro-android-bot-review

Proposed by Frans Gifford
Status: Merged
Merged at revision: 80
Proposed branch: lp:~fgiff/linaro-android-bot-review/ignore-dead-builds
Merge into: lp:linaro-android-bot-review
Diff against target: 51 lines (+18/-4)
2 files modified
androidbotreview.py (+3/-2)
jenkinsconnection.py (+15/-2)
To merge this branch: bzr merge lp:~fgiff/linaro-android-bot-review/ignore-dead-builds
Reviewer Review Type Date Requested Status
Bernhard Rosenkraenzer Approve
Linaro Android Bot Maintainers Pending
Review via email: mp+84976@code.launchpad.net

Description of the change

This prevents the bot from failing in the case that the a build has been garbage collected from Jenkins. Such a case is uncommon in normal usage, but can occur when testing against old changesets.

To post a comment you must log in.
Revision history for this message
Bernhard Rosenkraenzer (berolinux) wrote :

Looks good to me, but I don't think I have the privileges to approve this

review: Approve
Revision history for this message
Frans Gifford (fgiff) wrote :

> Looks good to me, but I don't think I have the privileges to approve this

Right, I'll merge it myself and fix the group privileges.

Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

Please don't forget to request this to be deployed (via ticket).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'androidbotreview.py'
2--- androidbotreview.py 2011-11-03 03:31:16 +0000
3+++ androidbotreview.py 2011-12-08 15:35:26 +0000
4@@ -189,7 +189,6 @@
5 # log.debug("%s", res)
6 except IOError:
7 # Failure to open the url may indicate:
8- # Job is in the build queue
9 # Network failure
10 # Other (!)
11 # Either way, we ignore and will retry on next execution.
12@@ -203,7 +202,9 @@
13
14 # Enter build result.
15 log.info("Jenkins build status: %s", res["result"])
16- if res["result"] != "SUCCESS":
17+ if res["result"] == "probably deleted":
18+ build_result = 0
19+ elif res["result"] != "SUCCESS":
20 build_result = -1
21 else:
22 build_result = 1
23
24=== modified file 'jenkinsconnection.py'
25--- jenkinsconnection.py 2011-10-31 21:28:47 +0000
26+++ jenkinsconnection.py 2011-12-08 15:35:26 +0000
27@@ -45,9 +45,22 @@
28 return jobs
29
30 def get_build_info(self, job, build):
31- url = "job/%s/%s/api/json" % (job, build)
32+ # Check if build is available
33+ url = "job/%s/api/json?tree=builds[number],lastStableBuild[number]" % (job)
34 resp = self.request(url)
35- return json.loads(resp)
36+ available_builds = json.loads(resp)
37+ if [b for b in available_builds["builds"] if int(b["number"]) == int(build)]:
38+ url = "job/%s/%s/api/json" % (job, build)
39+ resp = self.request(url)
40+ return json.loads(resp)
41+ else:
42+ # Build is probably queued.
43+ if [b for b in available_builds["builds"] if (b != available_builds["lastStableBuild"] and int(b["number"]) < int(build))]:
44+ return {"building": "building"}
45+ # Build is probably deleted.
46+ else:
47+ return {"building": False, "result": "probably deleted"}
48+
49
50 def get_last_build_no(self, job):
51 url = "job/%s/lastBuild/buildNumber" % job

Subscribers

People subscribed via source and target branches

to all changes: