diff options
Diffstat (limited to 'report_automation.py')
-rwxr-xr-x | report_automation.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/report_automation.py b/report_automation.py index 25e205b..6078047 100755 --- a/report_automation.py +++ b/report_automation.py @@ -17,13 +17,16 @@ from jenkinsapi.jenkins import Jenkins CTS_RESULT_FILE_NAME = "testResult.xml" class LinaroAndroidBuildSystem(object): - def __init__(self, base_url, project, + def __init__(self, base_url, build_job, username=None, password=None): - print("U: %s\nP: %s" % (base_url, project)) - self.project = project + print("Jenkins build job: %s" % build_job) + self.base_url = base_url + self.build_job = build_job + self.username = username + self.password = password try: - self.jenkins = Jenkins(base_url, username, password) - self.project = self.jenkins[project] + self.jenkins = Jenkins(self.base_url, self.username, self.password) + self.project = self.jenkins[self.build_job] except Exception as e: print("Can not get Jenkins job: %s" % project) print e @@ -37,7 +40,8 @@ class LinaroAndroidBuildSystem(object): print e def get_test_job_ids(self, build_no): - print("Querying build #%d test job ids" % build_no) + print("Querying build #%d test job ids from Jenkins build job: %s" % + (build_no, self.build_job)) job_id_list = [] build = self.get_build(build_no) job_id_list = re.findall("LAVA Job Id:\s\[?\'?(?P<master_job_id>[\d\.]+)", build.get_console()) @@ -239,30 +243,32 @@ class Report(object): if __name__ == '__main__': JENKINS_URL = "https://android-build.linaro.org/jenkins/" - JENKINS_PROJ = "linaro-android_lcr-member-juno" + JENKINS_JOB = "linaro-android_lcr-member-juno" LAVA_USERNAME = "arthur.she" LAVA_TOKEN = "a6eajjn85bp11n87u30oaxb11ewn687843btsdw63wc3gt10t72rqj4x3bi0bd0czuqotz8rp2w3moa5gja5r03u920f0duux10z78t7fcdslqi8omaxtnsgttgfcfs7" REPORT_TEMPLATE = "py3o_report_juno_template.odt" REPORT_OUTPUT = "py3o_report_juno_output.odt" parser = argparse.ArgumentParser() + parser.add_argument("-job", "--jenkins_job_name", type=str, default=JENKINS_JOB, + help="Specify the Jenkins job name. Default: %s" % JENKINS_JOB) + parser.add_argument("-bn", "--build_no", type=int, required=True, + help="Specify the Jenkins build number") parser.add_argument("-a", "--manual_lava_jobs", nargs = '+', help="Specify the test jobs that were submitted manually") parser.add_argument("-d", "--exclude_lava_jobs", nargs = '+', help="Specify the test jobs that wouldn't be included in the report") - parser.add_argument("-bn", "--build_no", type=int, required=True, help="Specify the Jenkins build number") args = parser.parse_args() - t = Template(REPORT_TEMPLATE, REPORT_OUTPUT) + t = Template(REPORT_TEMPLATE, REPORT_OUTPUT) rep_obj = Report() - jenkins = LinaroAndroidBuildSystem(JENKINS_URL, JENKINS_PROJ) + jenkins = LinaroAndroidBuildSystem(base_url=JENKINS_URL, build_job=args.jenkins_job_name) lava_server = LAVA(LAVA_USERNAME, LAVA_TOKEN) # Query test job IDs test_job_ids = [] test_job_ids = jenkins.get_test_job_ids(args.build_no) -# test_job_ids = ['527800', '527801.0', '527803.0', '527805.0', '527807.0', '527809.0', '527811.0', '527813.0', '527815.0', '527817.0', '527819.0', '527821.0', '527823.0', '527825.0', '527827.0', '527829.0', '527831.0', '527833.0', '527835.0', '527837.0', '527839.0', '527841.0', '527843.0', '527845.0'] print("Get the test job IDs:") if args.exclude_lava_jobs: test_job_ids = [id for id in test_job_ids if id not in args.exclude_lava_jobs] |