diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-09-22 02:07:33 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-09-22 02:07:33 +0100 |
commit | ed4ca896a6214b4ef1c07cd8a40b47bac3fbb9ae (patch) | |
tree | 7692b47fa1a611e8bdaf6d40c290f231fbcd215d /simplejenkinsapi | |
parent | c64c3a98cc88a4a0ba577fc4c6527bbbcf76bbf2 (diff) | |
download | jenkinstool-ed4ca896a6214b4ef1c07cd8a40b47bac3fbb9ae.tar.gz |
Trigger one job at a time, stop if a job fails
Diffstat (limited to 'simplejenkinsapi')
-rw-r--r-- | simplejenkinsapi/api.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/simplejenkinsapi/api.py b/simplejenkinsapi/api.py index 9fa3e23..cbdd970 100644 --- a/simplejenkinsapi/api.py +++ b/simplejenkinsapi/api.py @@ -64,7 +64,11 @@ class Jenkins(object): Otherwise, return as string. ''' - + + logging.debug('HTTP method: %s' % repr(method)) + logging.debug('HTTP path: %s' % repr(path)) + logging.debug('HTTP body: %s' % repr(body)) + logging.debug('HTTP headers: %s' % repr(headers)) conn = self._connect() conn.request(method, path, body, headers) resp = conn.getresponse() @@ -128,3 +132,13 @@ class Jenkins(object): '''Run an existing job.''' self._do('POST', '/job/%s/build' % job_id) + def get_latest_build_number(self, job_id): # pragma: no cover + '''Return number of latest finished build for a job.''' + obj = self._do('GET', '/job/%s/api/json' % job_id) + last = obj.get('lastBuild', None) or {} + return last.get('number', None) + + def get_build_info(self, job_id, build_number): # pragma: no cover + '''Return information about a specific build for a job.''' + return self._do('GET', '/job/%s/%s/api/json' % (job_id, build_number)) + |