Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and use build_info(). #10

Merged
merged 1 commit into from Jul 10, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions autojenkins/jobs.py
Expand Up @@ -11,6 +11,7 @@
BUILD = '{0}/job/{1}/build'
CONFIG = '{0}/job/{1}/config.xml'
JOBINFO = '{0}/job/{1}/' + API
BUILDINFO = '{0}/job/{1}/{2}/' + API
LIST = '{0}/' + API
LAST_SUCCESS = '{0}/job/{1}/lastSuccessfulBuild/' + API
TEST_REPORT = '{0}/job/{1}/lastSuccessfulBuild/testReport/' + API
Expand Down Expand Up @@ -99,12 +100,24 @@ def job_info(self, jobname):
response = self._get(JOBINFO, jobname)
return eval(response.content)

def build_info(self, jobname, build_number=None):
"""
Get information for a build of a job.

If no build number is specified, defaults to the most recent build.
"""
if build_number is not None:
args = (BUILDINFO, jobname, build_number)
else:
args = (LAST_BUILD, jobname)
response = self._get(*args)
return eval(response.content)

def last_build_info(self, jobname):
"""
Get information for last build of a job.
"""
response = self._get(LAST_BUILD, jobname)
return eval(response.content)
return self.build_info(jobname)

def last_build_report(self, jobname):
"""
Expand Down