nkjnm

Dependencies:   MAX44000 nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Committer:
nitsshukla
Date:
Fri Nov 04 12:06:04 2016 +0000
Revision:
7:3a65ef12ba31
Parent:
1:55a6170b404f
kghj;

Who changed what in which revision?

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