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 """This module integrates buildbucket with swarming. | 5 """This module integrates buildbucket with swarming. |
6 | 6 |
7 A bucket config may have "swarming" field that specifies how a builder | 7 A bucket config may have "swarming" field that specifies how a builder |
8 is mapped to a recipe. If build is scheduled for a bucket/builder | 8 is mapped to a recipe. If build is scheduled for a bucket/builder |
9 with swarming configuration, the integration overrides the default behavior. | 9 with swarming configuration, the integration overrides the default behavior. |
10 | 10 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 'CANCELED', | 404 'CANCELED', |
405 'COMPLETED' | 405 'COMPLETED' |
406 ) | 406 ) |
407 if state in ('PENDING', 'RUNNING'): | 407 if state in ('PENDING', 'RUNNING'): |
408 build.status = model.BuildStatus.STARTED | 408 build.status = model.BuildStatus.STARTED |
409 elif state in terminal_states: | 409 elif state in terminal_states: |
410 build.status = model.BuildStatus.COMPLETED | 410 build.status = model.BuildStatus.COMPLETED |
411 if state == 'CANCELED': | 411 if state == 'CANCELED': |
412 build.result = model.BuildResult.CANCELED | 412 build.result = model.BuildResult.CANCELED |
413 build.cancelation_reason = model.CancelationReason.CANCELED_EXPLICITLY | 413 build.cancelation_reason = model.CancelationReason.CANCELED_EXPLICITLY |
414 elif state in ('TIMED_OUT', 'EXPIRED'): | 414 elif state == 'EXPIRED': |
Vadim Sh.
2016/06/28 18:05:35
this is also INFRA_FAILURE, it happens when we hav
nodir
2016/06/28 22:13:50
Done.
| |
415 # Task did not start. | |
415 build.result = model.BuildResult.CANCELED | 416 build.result = model.BuildResult.CANCELED |
416 build.cancelation_reason = model.CancelationReason.TIMEOUT | 417 build.cancelation_reason = model.CancelationReason.TIMEOUT |
418 elif state == 'TIMED_OUT': | |
419 # Task started, but timed out. | |
420 build.result = model.BuildResult.FAILURE | |
421 build.failure_reason = model.FailureReason.INFRA_FAILURE | |
417 elif state == 'BOT_DIED' or result.get('internal_failure'): | 422 elif state == 'BOT_DIED' or result.get('internal_failure'): |
418 build.result = model.BuildResult.FAILURE | 423 build.result = model.BuildResult.FAILURE |
419 build.failure_reason = model.FailureReason.INFRA_FAILURE | 424 build.failure_reason = model.FailureReason.INFRA_FAILURE |
420 elif result.get('failure'): | 425 elif result.get('failure'): |
421 build.result = model.BuildResult.FAILURE | 426 build.result = model.BuildResult.FAILURE |
422 build.failure_reason = model.FailureReason.BUILD_FAILURE | 427 build.failure_reason = model.FailureReason.BUILD_FAILURE |
423 else: | 428 else: |
424 assert state == 'COMPLETED' | 429 assert state == 'COMPLETED' |
425 build.result = model.BuildResult.SUCCESS | 430 build.result = model.BuildResult.SUCCESS |
426 else: # pragma: no cover | 431 else: # pragma: no cover |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
667 def _extend_unique(target, items): | 672 def _extend_unique(target, items): |
668 for x in items: | 673 for x in items: |
669 if x not in target: # pragma: no branch | 674 if x not in target: # pragma: no branch |
670 target.append(x) | 675 target.append(x) |
671 | 676 |
672 | 677 |
673 class TaskToken(tokens.TokenKind): | 678 class TaskToken(tokens.TokenKind): |
674 expiration_sec = 60 * 60 * 24 # 24 hours. | 679 expiration_sec = 60 * 60 * 24 # 24 hours. |
675 secret_key = auth.SecretKey('swarming_task_token', scope='local') | 680 secret_key = auth.SecretKey('swarming_task_token', scope='local') |
676 version = 1 | 681 version = 1 |
OLD | NEW |