Clone of official tools

Committer:
Anders Blomdell
Date:
Thu Feb 04 17:17:13 2021 +0100
Revision:
47:21ae3e5a7128
Parent:
43:2a7da56ebd24
Add a few normpath calls

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:66f3b5499f7f 1 """
screamer 0:66f3b5499f7f 2 mbed SDK
screamer 0:66f3b5499f7f 3 Copyright (c) 2011-2013 ARM Limited
screamer 0:66f3b5499f7f 4
screamer 0:66f3b5499f7f 5 Licensed under the Apache License, Version 2.0 (the "License");
screamer 0:66f3b5499f7f 6 you may not use this file except in compliance with the License.
screamer 0:66f3b5499f7f 7 You may obtain a copy of the License at
screamer 0:66f3b5499f7f 8
screamer 0:66f3b5499f7f 9 http://www.apache.org/licenses/LICENSE-2.0
screamer 0:66f3b5499f7f 10
screamer 0:66f3b5499f7f 11 Unless required by applicable law or agreed to in writing, software
screamer 0:66f3b5499f7f 12 distributed under the License is distributed on an "AS IS" BASIS,
screamer 0:66f3b5499f7f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
screamer 0:66f3b5499f7f 14 See the License for the specific language governing permissions and
screamer 0:66f3b5499f7f 15 limitations under the License.
screamer 0:66f3b5499f7f 16 """
screamer 0:66f3b5499f7f 17 import sys
screamer 0:66f3b5499f7f 18 import argparse
screamer 0:66f3b5499f7f 19 import xml.etree.ElementTree as ET
screamer 0:66f3b5499f7f 20 import requests
screamer 0:66f3b5499f7f 21 import urlparse
screamer 0:66f3b5499f7f 22
screamer 0:66f3b5499f7f 23 def create_headers(args):
screamer 0:66f3b5499f7f 24 return { 'X-Api-Key': args.api_key }
screamer 0:66f3b5499f7f 25
screamer 0:66f3b5499f7f 26 def finish_command(command, response):
screamer 0:66f3b5499f7f 27 print(command, response.status_code, response.reason)
screamer 0:66f3b5499f7f 28 print(response.text)
screamer 0:66f3b5499f7f 29
screamer 0:66f3b5499f7f 30 if response.status_code < 400:
screamer 0:66f3b5499f7f 31 sys.exit(0)
screamer 0:66f3b5499f7f 32 else:
screamer 0:66f3b5499f7f 33 sys.exit(2)
screamer 0:66f3b5499f7f 34
screamer 0:66f3b5499f7f 35 def create_build(args):
screamer 0:66f3b5499f7f 36 build = {}
screamer 0:66f3b5499f7f 37 build['buildType'] = args.build_type
screamer 0:66f3b5499f7f 38 build['number'] = args.build_number
screamer 0:66f3b5499f7f 39 build['source'] = args.build_source
screamer 0:66f3b5499f7f 40 build['status'] = 'running'
screamer 0:66f3b5499f7f 41
screamer 0:66f3b5499f7f 42 r = requests.post(urlparse.urljoin(args.url, "api/builds"), headers=create_headers(args), json=build)
screamer 0:66f3b5499f7f 43
screamer 0:66f3b5499f7f 44 if r.status_code < 400:
screamer 0:66f3b5499f7f 45 if args.property_file_format:
screamer 0:66f3b5499f7f 46 print("MBED_BUILD_ID=" + r.text)
screamer 0:66f3b5499f7f 47 else:
screamer 0:66f3b5499f7f 48 print(r.text)
screamer 0:66f3b5499f7f 49
screamer 0:66f3b5499f7f 50 sys.exit(0)
screamer 0:66f3b5499f7f 51 else:
screamer 0:66f3b5499f7f 52 sys.exit(2)
screamer 0:66f3b5499f7f 53
screamer 0:66f3b5499f7f 54 def finish_build(args):
screamer 0:66f3b5499f7f 55 data = {}
screamer 0:66f3b5499f7f 56 data['status'] = 'completed'
screamer 0:66f3b5499f7f 57
screamer 0:66f3b5499f7f 58 r = requests.put(urlparse.urljoin(args.url, "api/builds/" + args.build_id), headers=create_headers(args), json=data)
screamer 0:66f3b5499f7f 59 finish_command('finish-build', r)
screamer 0:66f3b5499f7f 60
screamer 0:66f3b5499f7f 61 def promote_build(args):
screamer 0:66f3b5499f7f 62 data = {}
screamer 0:66f3b5499f7f 63 data['buildType'] = 'Release'
screamer 0:66f3b5499f7f 64
screamer 0:66f3b5499f7f 65 r = requests.put(urlparse.urljoin(args.url, "api/builds/" + args.build_id), headers=create_headers(args), json=data)
screamer 0:66f3b5499f7f 66 finish_command('promote-build', r)
screamer 0:66f3b5499f7f 67
screamer 0:66f3b5499f7f 68 def abort_build(args):
screamer 0:66f3b5499f7f 69 data = {}
screamer 0:66f3b5499f7f 70 data['status'] = 'aborted'
screamer 0:66f3b5499f7f 71
screamer 0:66f3b5499f7f 72 r = requests.put(urlparse.urljoin(args.url, "api/builds/" + args.build_id), headers=create_headers(args), json=data)
screamer 0:66f3b5499f7f 73 finish_command('abort-build', r)
screamer 0:66f3b5499f7f 74
screamer 0:66f3b5499f7f 75 def add_project_runs(args):
screamer 0:66f3b5499f7f 76 '''
screamer 0:66f3b5499f7f 77 -------------------------------------
screamer 0:66f3b5499f7f 78 Notes on 'project_run_data' structure:
screamer 0:66f3b5499f7f 79 --------------------------------------
screamer 0:66f3b5499f7f 80 'projectRuns' - Tree structure used to keep track of what projects have
screamer 0:66f3b5499f7f 81 been logged in different report files. The tree is organized as follows:
screamer 0:66f3b5499f7f 82
screamer 0:66f3b5499f7f 83 'projectRuns': { - Root element of tree
screamer 0:66f3b5499f7f 84
screamer 0:66f3b5499f7f 85 'hostOs': { - Host OS on which project was built/tested
screamer 0:66f3b5499f7f 86 - ex. windows, linux, or mac
screamer 0:66f3b5499f7f 87
screamer 0:66f3b5499f7f 88 'platform': { - Platform for which project was built/tested
screamer 0:66f3b5499f7f 89 (Corresponds to platform names in targets.py)
screamer 0:66f3b5499f7f 90 - ex. K64F, LPC1768, NRF51822, etc.
screamer 0:66f3b5499f7f 91
screamer 0:66f3b5499f7f 92 'toolchain': { - Toolchain with which project was built/tested
screamer 0:66f3b5499f7f 93 (Corresponds to TOOLCHAIN_CLASSES names in toolchains/__init__.py)
screamer 0:66f3b5499f7f 94 - ex. ARM, uARM, GCC_ARM, etc.
screamer 0:66f3b5499f7f 95
screamer 0:66f3b5499f7f 96 'project': { - Project that was build/tested
screamer 0:66f3b5499f7f 97 (Corresponds to test id in tests.py or library id in libraries.py)
screamer 0:66f3b5499f7f 98 - For tests, ex. MBED_A1, MBED_11, DTCT_1 etc.
screamer 0:66f3b5499f7f 99 - For libraries, ex. MBED, RTX, RTOS, etc.
screamer 0:66f3b5499f7f 100
screamer 0:66f3b5499f7f 101 },
screamer 0:66f3b5499f7f 102 ...
screamer 0:66f3b5499f7f 103 },
screamer 0:66f3b5499f7f 104 ...
screamer 0:66f3b5499f7f 105 },
screamer 0:66f3b5499f7f 106 ...
screamer 0:66f3b5499f7f 107 }
screamer 0:66f3b5499f7f 108 }
screamer 0:66f3b5499f7f 109
screamer 0:66f3b5499f7f 110 'platforms_set' - Set of all the platform names mentioned in the given report files
screamer 0:66f3b5499f7f 111
screamer 0:66f3b5499f7f 112 'toolchains_set' - Set of all the toolchain names mentioned in the given report files
screamer 0:66f3b5499f7f 113
screamer 0:66f3b5499f7f 114 'names_set' - Set of all the project names mentioned in the given report files
screamer 0:66f3b5499f7f 115
screamer 0:66f3b5499f7f 116 'hostOses_set' - Set of all the host names given (only given by the command line arguments)
screamer 0:66f3b5499f7f 117 '''
screamer 0:66f3b5499f7f 118
screamer 0:66f3b5499f7f 119 project_run_data = {}
screamer 0:66f3b5499f7f 120 project_run_data['projectRuns'] = {}
screamer 0:66f3b5499f7f 121 project_run_data['platforms_set'] = set()
screamer 0:66f3b5499f7f 122 project_run_data['vendors_set'] = set()
screamer 0:66f3b5499f7f 123 project_run_data['toolchains_set'] = set()
screamer 0:66f3b5499f7f 124 project_run_data['names_set'] = set()
screamer 0:66f3b5499f7f 125 project_run_data['hostOses_set'] = set()
screamer 0:66f3b5499f7f 126 project_run_data['hostOses_set'].add(args.host_os)
screamer 0:66f3b5499f7f 127
screamer 13:ab47a20b66f0 128 if args.build_report:
screamer 13:ab47a20b66f0 129 add_report(project_run_data, args.build_report, True, args.build_id, args.host_os)
screamer 0:66f3b5499f7f 130
screamer 13:ab47a20b66f0 131 if args.test_report:
screamer 0:66f3b5499f7f 132 add_report(project_run_data, args.test_report, False, args.build_id, args.host_os)
screamer 0:66f3b5499f7f 133
screamer 13:ab47a20b66f0 134 ts_data = format_project_run_data(project_run_data, args.limit)
screamer 13:ab47a20b66f0 135 total_result = True
screamer 13:ab47a20b66f0 136
screamer 13:ab47a20b66f0 137 total_parts = len(ts_data)
screamer 13:ab47a20b66f0 138 print "Uploading project runs in %d parts" % total_parts
screamer 13:ab47a20b66f0 139
screamer 13:ab47a20b66f0 140 for index, data in enumerate(ts_data):
screamer 13:ab47a20b66f0 141 r = requests.post(urlparse.urljoin(args.url, "api/projectRuns"), headers=create_headers(args), json=data)
screamer 13:ab47a20b66f0 142 print("add-project-runs part %d/%d" % (index + 1, total_parts), r.status_code, r.reason)
screamer 13:ab47a20b66f0 143 print(r.text)
screamer 13:ab47a20b66f0 144
screamer 13:ab47a20b66f0 145 if r.status_code >= 400:
screamer 13:ab47a20b66f0 146 total_result = False
screamer 13:ab47a20b66f0 147
screamer 13:ab47a20b66f0 148 if total_result:
screamer 13:ab47a20b66f0 149 print "'add-project-runs' completed successfully"
screamer 13:ab47a20b66f0 150 sys.exit(0)
screamer 13:ab47a20b66f0 151 else:
screamer 13:ab47a20b66f0 152 print "'add-project-runs' failed"
screamer 13:ab47a20b66f0 153 sys.exit(2)
screamer 0:66f3b5499f7f 154
screamer 13:ab47a20b66f0 155 def prep_ts_data():
screamer 0:66f3b5499f7f 156 ts_data = {}
screamer 0:66f3b5499f7f 157 ts_data['projectRuns'] = []
screamer 13:ab47a20b66f0 158 ts_data['platforms'] = set()
screamer 13:ab47a20b66f0 159 ts_data['vendors'] = set()
screamer 13:ab47a20b66f0 160 ts_data['toolchains'] = set()
screamer 13:ab47a20b66f0 161 ts_data['names'] = set()
screamer 13:ab47a20b66f0 162 ts_data['hostOses'] = set()
screamer 13:ab47a20b66f0 163 return ts_data
screamer 13:ab47a20b66f0 164
screamer 13:ab47a20b66f0 165 def finish_ts_data(ts_data, project_run_data):
screamer 13:ab47a20b66f0 166 ts_data['platforms'] = list(ts_data['platforms'])
screamer 13:ab47a20b66f0 167 ts_data['vendors'] = list(ts_data['vendors'])
screamer 13:ab47a20b66f0 168 ts_data['toolchains'] = list(ts_data['toolchains'])
screamer 13:ab47a20b66f0 169 ts_data['names'] = list(ts_data['names'])
screamer 13:ab47a20b66f0 170 ts_data['hostOses'] = list(ts_data['hostOses'])
screamer 13:ab47a20b66f0 171
screamer 13:ab47a20b66f0 172 # Add all vendors to every projectRun submission
screamer 13:ab47a20b66f0 173 # TODO Either add "vendor" to the "project_run_data"
screamer 13:ab47a20b66f0 174 # or remove "vendor" entirely from the viewer
screamer 13:ab47a20b66f0 175 ts_data['vendors'] = list(project_run_data['vendors_set'])
screamer 13:ab47a20b66f0 176
screamer 13:ab47a20b66f0 177 def format_project_run_data(project_run_data, limit):
screamer 13:ab47a20b66f0 178 all_ts_data = []
screamer 13:ab47a20b66f0 179 current_limit_count = 0
screamer 13:ab47a20b66f0 180
screamer 13:ab47a20b66f0 181 ts_data = prep_ts_data()
screamer 13:ab47a20b66f0 182 ts_data['projectRuns'] = []
screamer 0:66f3b5499f7f 183
theotherjimmy 43:2a7da56ebd24 184 for hostOs_name, hostOs in project_run_data['projectRuns'].items():
theotherjimmy 43:2a7da56ebd24 185 for platform_name, platform in hostOs.items():
theotherjimmy 43:2a7da56ebd24 186 for toolchain_name, toolchain in platform.items():
theotherjimmy 43:2a7da56ebd24 187 for project_name, project in toolchain.items():
screamer 13:ab47a20b66f0 188 if current_limit_count >= limit:
screamer 13:ab47a20b66f0 189 finish_ts_data(ts_data, project_run_data)
screamer 13:ab47a20b66f0 190 all_ts_data.append(ts_data)
screamer 13:ab47a20b66f0 191 ts_data = prep_ts_data()
screamer 13:ab47a20b66f0 192 current_limit_count = 0
screamer 13:ab47a20b66f0 193
screamer 0:66f3b5499f7f 194 ts_data['projectRuns'].append(project)
screamer 13:ab47a20b66f0 195 ts_data['platforms'].add(platform_name)
screamer 13:ab47a20b66f0 196 ts_data['toolchains'].add(toolchain_name)
screamer 13:ab47a20b66f0 197 ts_data['names'].add(project_name)
screamer 13:ab47a20b66f0 198 ts_data['hostOses'].add(hostOs_name)
screamer 13:ab47a20b66f0 199 current_limit_count += 1
screamer 13:ab47a20b66f0 200
screamer 13:ab47a20b66f0 201 if current_limit_count > 0:
screamer 13:ab47a20b66f0 202 finish_ts_data(ts_data, project_run_data)
screamer 13:ab47a20b66f0 203 all_ts_data.append(ts_data)
screamer 13:ab47a20b66f0 204
screamer 13:ab47a20b66f0 205 return all_ts_data
screamer 0:66f3b5499f7f 206
screamer 0:66f3b5499f7f 207 def find_project_run(projectRuns, project):
screamer 0:66f3b5499f7f 208 keys = ['hostOs', 'platform', 'toolchain', 'project']
screamer 0:66f3b5499f7f 209
screamer 0:66f3b5499f7f 210 elem = projectRuns
screamer 0:66f3b5499f7f 211
screamer 0:66f3b5499f7f 212 for key in keys:
screamer 0:66f3b5499f7f 213 if not project[key] in elem:
screamer 0:66f3b5499f7f 214 return None
screamer 0:66f3b5499f7f 215
screamer 0:66f3b5499f7f 216 elem = elem[project[key]]
screamer 0:66f3b5499f7f 217
screamer 0:66f3b5499f7f 218 return elem
screamer 0:66f3b5499f7f 219
screamer 0:66f3b5499f7f 220 def add_project_run(projectRuns, project):
screamer 0:66f3b5499f7f 221 keys = ['hostOs', 'platform', 'toolchain']
screamer 0:66f3b5499f7f 222
screamer 0:66f3b5499f7f 223 elem = projectRuns
screamer 0:66f3b5499f7f 224
screamer 0:66f3b5499f7f 225 for key in keys:
screamer 0:66f3b5499f7f 226 if not project[key] in elem:
screamer 0:66f3b5499f7f 227 elem[project[key]] = {}
screamer 0:66f3b5499f7f 228
screamer 0:66f3b5499f7f 229 elem = elem[project[key]]
screamer 0:66f3b5499f7f 230
screamer 0:66f3b5499f7f 231 elem[project['project']] = project
screamer 0:66f3b5499f7f 232
screamer 0:66f3b5499f7f 233 def update_project_run_results(project_to_update, project, is_build):
screamer 0:66f3b5499f7f 234 if is_build:
screamer 0:66f3b5499f7f 235 project_to_update['buildPass'] = project['buildPass']
screamer 0:66f3b5499f7f 236 project_to_update['buildResult'] = project['buildResult']
screamer 0:66f3b5499f7f 237 project_to_update['buildOutput'] = project['buildOutput']
screamer 0:66f3b5499f7f 238 else:
screamer 0:66f3b5499f7f 239 project_to_update['testPass'] = project['testPass']
screamer 0:66f3b5499f7f 240 project_to_update['testResult'] = project['testResult']
screamer 0:66f3b5499f7f 241 project_to_update['testOutput'] = project['testOutput']
screamer 0:66f3b5499f7f 242
screamer 0:66f3b5499f7f 243 def update_project_run(projectRuns, project, is_build):
screamer 0:66f3b5499f7f 244 found_project = find_project_run(projectRuns, project)
screamer 0:66f3b5499f7f 245 if found_project:
screamer 0:66f3b5499f7f 246 update_project_run_results(found_project, project, is_build)
screamer 0:66f3b5499f7f 247 else:
screamer 0:66f3b5499f7f 248 add_project_run(projectRuns, project)
screamer 0:66f3b5499f7f 249
screamer 0:66f3b5499f7f 250 def add_report(project_run_data, report_file, is_build, build_id, host_os):
screamer 0:66f3b5499f7f 251 tree = None
screamer 0:66f3b5499f7f 252
screamer 0:66f3b5499f7f 253 try:
screamer 0:66f3b5499f7f 254 tree = ET.parse(report_file)
screamer 0:66f3b5499f7f 255 except:
screamer 0:66f3b5499f7f 256 print(sys.exc_info()[0])
screamer 0:66f3b5499f7f 257 print('Invalid path to report: %s', report_file)
screamer 0:66f3b5499f7f 258 sys.exit(1)
screamer 0:66f3b5499f7f 259
screamer 0:66f3b5499f7f 260 test_suites = tree.getroot()
screamer 0:66f3b5499f7f 261
screamer 0:66f3b5499f7f 262 for test_suite in test_suites:
screamer 0:66f3b5499f7f 263 platform = ""
screamer 0:66f3b5499f7f 264 toolchain = ""
screamer 0:66f3b5499f7f 265 vendor = ""
screamer 0:66f3b5499f7f 266 for properties in test_suite.findall('properties'):
screamer 0:66f3b5499f7f 267 for property in properties.findall('property'):
screamer 0:66f3b5499f7f 268 if property.attrib['name'] == 'target':
screamer 0:66f3b5499f7f 269 platform = property.attrib['value']
screamer 0:66f3b5499f7f 270 project_run_data['platforms_set'].add(platform)
screamer 0:66f3b5499f7f 271 elif property.attrib['name'] == 'toolchain':
screamer 0:66f3b5499f7f 272 toolchain = property.attrib['value']
screamer 0:66f3b5499f7f 273 project_run_data['toolchains_set'].add(toolchain)
screamer 0:66f3b5499f7f 274 elif property.attrib['name'] == 'vendor':
screamer 0:66f3b5499f7f 275 vendor = property.attrib['value']
screamer 0:66f3b5499f7f 276 project_run_data['vendors_set'].add(vendor)
screamer 0:66f3b5499f7f 277
screamer 0:66f3b5499f7f 278 for test_case in test_suite.findall('testcase'):
screamer 0:66f3b5499f7f 279 projectRun = {}
screamer 0:66f3b5499f7f 280 projectRun['build'] = build_id
screamer 0:66f3b5499f7f 281 projectRun['hostOs'] = host_os
screamer 0:66f3b5499f7f 282 projectRun['platform'] = platform
screamer 0:66f3b5499f7f 283 projectRun['toolchain'] = toolchain
screamer 0:66f3b5499f7f 284 projectRun['project'] = test_case.attrib['classname'].split('.')[-1]
screamer 0:66f3b5499f7f 285 projectRun['vendor'] = vendor
screamer 0:66f3b5499f7f 286
screamer 0:66f3b5499f7f 287 project_run_data['names_set'].add(projectRun['project'])
screamer 0:66f3b5499f7f 288
screamer 0:66f3b5499f7f 289 should_skip = False
screamer 0:66f3b5499f7f 290 skips = test_case.findall('skipped')
screamer 0:66f3b5499f7f 291
screamer 0:66f3b5499f7f 292 if skips:
screamer 0:66f3b5499f7f 293 should_skip = skips[0].attrib['message'] == 'SKIP'
screamer 0:66f3b5499f7f 294
screamer 0:66f3b5499f7f 295 if not should_skip:
screamer 0:66f3b5499f7f 296 system_outs = test_case.findall('system-out')
screamer 0:66f3b5499f7f 297
screamer 0:66f3b5499f7f 298 output = ""
screamer 0:66f3b5499f7f 299 if system_outs:
screamer 0:66f3b5499f7f 300 output = system_outs[0].text
screamer 0:66f3b5499f7f 301
screamer 0:66f3b5499f7f 302 if is_build:
screamer 0:66f3b5499f7f 303 projectRun['buildOutput'] = output
screamer 0:66f3b5499f7f 304 else:
screamer 0:66f3b5499f7f 305 projectRun['testOutput'] = output
screamer 0:66f3b5499f7f 306
screamer 0:66f3b5499f7f 307 errors = test_case.findall('error')
screamer 0:66f3b5499f7f 308 failures = test_case.findall('failure')
screamer 0:66f3b5499f7f 309 projectRunPass = None
screamer 0:66f3b5499f7f 310 result = None
screamer 0:66f3b5499f7f 311
screamer 0:66f3b5499f7f 312 if errors:
screamer 0:66f3b5499f7f 313 projectRunPass = False
screamer 0:66f3b5499f7f 314 result = errors[0].attrib['message']
screamer 0:66f3b5499f7f 315 elif failures:
screamer 0:66f3b5499f7f 316 projectRunPass = False
screamer 0:66f3b5499f7f 317 result = failures[0].attrib['message']
screamer 0:66f3b5499f7f 318 elif skips:
screamer 0:66f3b5499f7f 319 projectRunPass = True
screamer 0:66f3b5499f7f 320 result = skips[0].attrib['message']
screamer 0:66f3b5499f7f 321 else:
screamer 0:66f3b5499f7f 322 projectRunPass = True
screamer 0:66f3b5499f7f 323 result = 'OK'
screamer 0:66f3b5499f7f 324
screamer 0:66f3b5499f7f 325 if is_build:
screamer 0:66f3b5499f7f 326 projectRun['buildPass'] = projectRunPass
screamer 0:66f3b5499f7f 327 projectRun['buildResult'] = result
screamer 0:66f3b5499f7f 328 else:
screamer 0:66f3b5499f7f 329 projectRun['testPass'] = projectRunPass
screamer 0:66f3b5499f7f 330 projectRun['testResult'] = result
screamer 0:66f3b5499f7f 331
screamer 0:66f3b5499f7f 332 update_project_run(project_run_data['projectRuns'], projectRun, is_build)
screamer 0:66f3b5499f7f 333
screamer 0:66f3b5499f7f 334 def main(arguments):
screamer 0:66f3b5499f7f 335 # Register and parse command line arguments
screamer 0:66f3b5499f7f 336 parser = argparse.ArgumentParser()
screamer 0:66f3b5499f7f 337 parser.add_argument('-u', '--url', required=True, help='url to ci site')
screamer 0:66f3b5499f7f 338 parser.add_argument('-k', '--api-key', required=True, help='api-key for posting data')
screamer 0:66f3b5499f7f 339
screamer 0:66f3b5499f7f 340 subparsers = parser.add_subparsers(help='subcommand help')
screamer 0:66f3b5499f7f 341
screamer 0:66f3b5499f7f 342 create_build_parser = subparsers.add_parser('create-build', help='create a new build')
screamer 0:66f3b5499f7f 343 create_build_parser.add_argument('-b', '--build-number', required=True, help='build number')
screamer 0:66f3b5499f7f 344 create_build_parser.add_argument('-T', '--build-type', choices=['Nightly', 'Limited', 'Pull_Request', 'Release_Candidate'], required=True, help='type of build')
screamer 0:66f3b5499f7f 345 create_build_parser.add_argument('-s', '--build-source', required=True, help='url to source of build')
screamer 0:66f3b5499f7f 346 create_build_parser.add_argument('-p', '--property-file-format', action='store_true', help='print result in the property file format')
screamer 0:66f3b5499f7f 347 create_build_parser.set_defaults(func=create_build)
screamer 0:66f3b5499f7f 348
screamer 0:66f3b5499f7f 349 finish_build_parser = subparsers.add_parser('finish-build', help='finish a running build')
screamer 0:66f3b5499f7f 350 finish_build_parser.add_argument('-b', '--build-id', required=True, help='build id')
screamer 0:66f3b5499f7f 351 finish_build_parser.set_defaults(func=finish_build)
screamer 0:66f3b5499f7f 352
screamer 0:66f3b5499f7f 353 finish_build_parser = subparsers.add_parser('promote-build', help='promote a build to a release')
screamer 0:66f3b5499f7f 354 finish_build_parser.add_argument('-b', '--build-id', required=True, help='build id')
screamer 0:66f3b5499f7f 355 finish_build_parser.set_defaults(func=promote_build)
screamer 0:66f3b5499f7f 356
screamer 0:66f3b5499f7f 357 abort_build_parser = subparsers.add_parser('abort-build', help='abort a running build')
screamer 0:66f3b5499f7f 358 abort_build_parser.add_argument('-b', '--build-id', required=True, help='build id')
screamer 0:66f3b5499f7f 359 abort_build_parser.set_defaults(func=abort_build)
screamer 0:66f3b5499f7f 360
screamer 0:66f3b5499f7f 361 add_project_runs_parser = subparsers.add_parser('add-project-runs', help='add project runs to a build')
screamer 0:66f3b5499f7f 362 add_project_runs_parser.add_argument('-b', '--build-id', required=True, help='build id')
screamer 13:ab47a20b66f0 363 add_project_runs_parser.add_argument('-r', '--build-report', required=False, help='path to junit xml build report')
screamer 0:66f3b5499f7f 364 add_project_runs_parser.add_argument('-t', '--test-report', required=False, help='path to junit xml test report')
screamer 0:66f3b5499f7f 365 add_project_runs_parser.add_argument('-o', '--host-os', required=True, help='host os on which test was run')
screamer 13:ab47a20b66f0 366 add_project_runs_parser.add_argument('-l', '--limit', required=False, type=int, default=1000, help='Limit the number of project runs sent at a time to avoid HTTP errors (default is 1000)')
screamer 0:66f3b5499f7f 367 add_project_runs_parser.set_defaults(func=add_project_runs)
screamer 0:66f3b5499f7f 368
screamer 0:66f3b5499f7f 369 args = parser.parse_args(arguments)
screamer 0:66f3b5499f7f 370 args.func(args)
screamer 0:66f3b5499f7f 371
screamer 0:66f3b5499f7f 372 if __name__ == '__main__':
screamer 0:66f3b5499f7f 373 main(sys.argv[1:])