Jobs without the first build can throw error
authorVyacheslav Linnik <vyacheslav.linnik@gmail.com>
Fri, 22 Nov 2013 04:21:54 +0000 (08:21 +0400)
committerVyacheslav Linnik <vyacheslav.linnik@gmail.com>
Fri, 22 Nov 2013 04:21:54 +0000 (08:21 +0400)
jenkinsapi/job.py

index 29c1b705340a237ad229ec02ad6bcdbcf424b335..d5e1b6931e17e0606047d955bb6efee5bbd36a16 100644 (file)
@@ -87,7 +87,7 @@ class Job(JenkinsBase, MutableJenkinsThing):
         Jenkins API loads the first 100 builds and thus may not contain all builds
         information. This method checks if all builds are loaded in the data object
         and updates it with the missing builds if needed.'''
-        if not data.get("builds"):
+        if not (data.get("builds") and data.get("firstBuild")):
             return data
         # do not call _buildid_for_type here: it would poll and do an infinite loop
         oldest_loaded_build_number = data["builds"][-1]["number"]