Add get_build convenience function.
authorJoshua Boyd <jdboyd@jdboyd.net>
Mon, 13 Aug 2012 22:45:05 +0000 (19:45 -0300)
committerJoshua Boyd <jdboyd@jdboyd.net>
Mon, 13 Aug 2012 22:45:05 +0000 (19:45 -0300)
A handy shortcut for interactive use, if nothing else.

jenkinsapi/api.py

index a906288..1186a33 100644 (file)
@@ -34,6 +34,14 @@ def get_latest_complete_build(jenkinsurl, jobname):
     job = jenkinsci[jobname]
     return job.get_last_completed_build()
 
+def get_build(jenkinsurl, jobname, build_no):
+    """
+    A convenience function to fetch down the test results from a jenkins job by build number.
+    """
+    jenkinsci = Jenkins(jenkinsurl)
+    job = jenkinsci[jobname]
+    return job.get_build( build_no )
+
 def get_artifacts( jenkinsurl, jobid=None, build_no=None, proxyhost=None, proxyport=None, proxyuser=None, proxypass=None ):
     """
     Find all the artifacts for the latest build of a job.