OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Post a try job request via HTTP to the Tryserver to produce build.""" | 5 """Post a try job request via HTTP to the Tryserver to produce build.""" |
6 | 6 |
7 import getpass | 7 import getpass |
8 import json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 Args: | 227 Args: |
228 build_num: A build number on tryserver to determine its status. | 228 build_num: A build number on tryserver to determine its status. |
229 bot_name: Name of the bot where the build information is scanned. | 229 bot_name: Name of the bot where the build information is scanned. |
230 builder_host: Hostname of the server where the builder is hosted. | 230 builder_host: Hostname of the server where the builder is hosted. |
231 builder_port: Port number of ther server where the builder is hosted. | 231 builder_port: Port number of ther server where the builder is hosted. |
232 | 232 |
233 Returns: | 233 Returns: |
234 A tuple consists of build status (SUCCESS, FAILED or PENDING) and a link | 234 A tuple consists of build status (SUCCESS, FAILED or PENDING) and a link |
235 to build status page on the waterfall. | 235 to build status page on the waterfall. |
236 """ | 236 """ |
237 # Gets the buildbot url for the given host and port. | |
238 server_url = _GetBuildBotUrl(builder_host, builder_port) | |
239 buildbot_url = BUILDER_JSON_URL % {'server_url': server_url, | |
240 'bot_name': bot_name, | |
241 'build_num': build_num | |
242 } | |
243 build_data = _GetBuildData(buildbot_url) | |
244 results_url = None | 237 results_url = None |
245 if build_data: | 238 if build_num: |
246 # Link to build on the buildbot showing status of build steps. | 239 # Gets the buildbot url for the given host and port. |
247 results_url = BUILDER_HTML_URL % {'server_url': server_url, | 240 server_url = _GetBuildBotUrl(builder_host, builder_port) |
248 'bot_name': bot_name, | 241 buildbot_url = BUILDER_JSON_URL % {'server_url': server_url, |
ghost stip (do not use)
2014/05/23 00:40:23
it would be ideal to use http://chrome-build-extra
prasadv
2014/05/23 17:56:19
Thank you Mike,
Can bisect bot on master4 access
| |
249 'build_num': build_num | 242 'bot_name': bot_name, |
250 } | 243 'build_num': build_num |
251 if _IsBuildFailed(build_data): | 244 } |
252 return (FAILED, results_url) | 245 build_data = _GetBuildData(buildbot_url) |
246 if build_data: | |
247 # Link to build on the buildbot showing status of build steps. | |
248 results_url = BUILDER_HTML_URL % {'server_url': server_url, | |
249 'bot_name': bot_name, | |
250 'build_num': build_num | |
251 } | |
252 if _IsBuildFailed(build_data): | |
253 return (FAILED, results_url) | |
253 | 254 |
254 elif _IsBuildSuccessful(build_data): | 255 elif _IsBuildSuccessful(build_data): |
255 return (OK, results_url) | 256 return (OK, results_url) |
256 return (PENDING, results_url) | 257 return (PENDING, results_url) |
257 | 258 |
258 | 259 |
259 def GetBuildNumFromBuilder(build_reason, bot_name, builder_host, builder_port): | 260 def GetBuildNumFromBuilder(build_reason, bot_name, builder_host, builder_port): |
260 """Gets build number on build status page for a given build reason. | 261 """Gets build number on build status page for a given build reason. |
261 | 262 |
262 It parses the JSON data from buildbot page and collect basic information | 263 It parses the JSON data from buildbot page and collect basic information |
263 about the all the builds and then this uniquely identifies the build based | 264 about the all the builds and then this uniquely identifies the build based |
264 on the 'reason' attribute in builds's JSON data. | 265 on the 'reason' attribute in builds's JSON data. |
265 The 'reason' attribute set while a build request is posted, and same is used | 266 The 'reason' attribute set while a build request is posted, and same is used |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 if not options.port: | 363 if not options.port: |
363 raise ServerAccessError('Please use the --port option to specify the try ' | 364 raise ServerAccessError('Please use the --port option to specify the try ' |
364 'server port to connect to.') | 365 'server port to connect to.') |
365 params = _GetQueryParams(options) | 366 params = _GetQueryParams(options) |
366 PostTryJob(params) | 367 PostTryJob(params) |
367 | 368 |
368 | 369 |
369 if __name__ == '__main__': | 370 if __name__ == '__main__': |
370 sys.exit(Main(sys.argv)) | 371 sys.exit(Main(sys.argv)) |
371 | 372 |
OLD | NEW |