From: Yonghee Han Date: Tue, 25 Oct 2016 06:49:35 +0000 (+0900) Subject: Add gitbuildstatus in Prerelease project X-Git-Tag: submit/trunk/20190927.012743~574^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44980854046ea55aa46dd0500b1c94e278ea52a9;p=services%2Fjenkins-scripts.git Add gitbuildstatus in Prerelease project Change-Id: I6ed6e93182f732bbf9a5a033a27b88d5b82827d3 --- diff --git a/common/buildservice.py b/common/buildservice.py index 0cf0cf9..1182af7 100755 --- a/common/buildservice.py +++ b/common/buildservice.py @@ -859,6 +859,45 @@ class BuildService(OSC): raise return + + def get_build_results(self, prj, view=None, code=None,): + """ get build results """ + + query = [] + if view: + query.append('view=%s' %(view)) + else: + query.append('view=summary') + + if code: + query.append('code=%s' %(code)) + + u = core.makeurl(self.apiurl, ['build', prj, '_result'],query=query) + try: + f = core.http_GET(u) + return ''.join(f.readlines()) + except urllib2.HTTPError, err: + print err + return err + + def getbuildstatus(self, project): + """ get build status """ + resultdata = {} + summarylist = [] + results_summary = self.get_build_results(project) + et = ElementTree.fromstring(''.join(results_summary)) + for result in et.findall('result'): + for summary in result.findall('summary'): + for status in summary.findall('statuscount'): + if status.get('code') in ("succeeded","unresolvable","failed"): + summarylist.append({'repo':result.get('repository'), \ + 'arch':result.get('arch'), \ + 'code':status.get('code'), \ + 'count':status.get('count') + }) + resultdata['buildstatus'] = summarylist + return resultdata + def addPerson(self, prj, users): """ add persons to a project diff --git a/job_pre_release_obs.py b/job_pre_release_obs.py index 243acef..c1b49be 100755 --- a/job_pre_release_obs.py +++ b/job_pre_release_obs.py @@ -311,6 +311,10 @@ def main(action): if action == 'create_images': repo = content.get("repo") + info = build.get_info(project) + buildstatus = build.getbuildstatus(project) + print 'buildstatus=%s' %(buildstatus) + build.update_buildstatus(buildstatus,project) # cleanup src.rpm files on Live repo # we don't used src.rpm files on prerelease project.