OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """CBuildbot is wrapper around the build process used by the pre-flight queue""" | 7 """CBuildbot is wrapper around the build process used by the pre-flight queue""" |
8 | 8 |
9 import errno | 9 import errno |
10 import heapq | 10 import heapq |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 '--overlays=%s' % ':'.join(overlays), | 490 '--overlays=%s' % ':'.join(overlays), |
491 '--tracking_branch=%s' % tracking_branch | 491 '--tracking_branch=%s' % tracking_branch |
492 ] | 492 ] |
493 if dryrun: | 493 if dryrun: |
494 cmd.append('--dryrun') | 494 cmd.append('--dryrun') |
495 | 495 |
496 cmd.append('push') | 496 cmd.append('push') |
497 RunCommand(cmd, cwd=cwd) | 497 RunCommand(cmd, cwd=cwd) |
498 | 498 |
499 | 499 |
500 def _LegacyArchiveBuild(bot_id, buildconfig, buildnumber, debug=False): | 500 def _LegacyArchiveBuild(buildroot, bot_id, buildconfig, buildnumber, |
| 501 debug=False): |
501 """Adds a step to the factory to archive a build.""" | 502 """Adds a step to the factory to archive a build.""" |
502 | 503 |
503 # Fixed properties | 504 # Fixed properties |
504 keep_max = 3 | 505 keep_max = 3 |
505 gsutil_archive = 'gs://chromeos-archive/' + bot_id | 506 gsutil_archive = 'gs://chromeos-archive/' + bot_id |
| 507 cwd = os.path.join(buildroot, 'src', 'scripts') |
506 | 508 |
507 cmd = ['./archive_build.sh', | 509 cmd = ['./archive_build.sh', |
508 '--build_number', str(buildnumber), | 510 '--build_number', str(buildnumber), |
509 '--to', '/var/www/archive/' + bot_id, | 511 '--to', '/var/www/archive/' + bot_id, |
510 '--keep_max', str(keep_max), | 512 '--keep_max', str(keep_max), |
511 '--prebuilt_upload', | 513 '--prebuilt_upload', |
512 '--board', buildconfig['board'], | 514 '--board', buildconfig['board'], |
513 | 515 |
514 '--acl', '/home/chrome-bot/slave_archive_acl', | 516 '--acl', '/home/chrome-bot/slave_archive_acl', |
515 '--gsutil_archive', gsutil_archive, | 517 '--gsutil_archive', gsutil_archive, |
516 '--gsd_gen_index', | 518 '--gsd_gen_index', |
517 '/b/scripts/gsd_generate_index/gsd_generate_index.py', | 519 '/b/scripts/gsd_generate_index/gsd_generate_index.py', |
518 '--gsutil', '/b/scripts/slave/gsutil', | 520 '--gsutil', '/b/scripts/slave/gsutil', |
519 '--test_mod' | 521 '--test_mod' |
520 ] | 522 ] |
521 | 523 |
522 if buildconfig.get('test_mod', True): | 524 if buildconfig.get('test_mod', True): |
523 cmd.append('--test_mod') | 525 cmd.append('--test_mod') |
524 | 526 |
525 if buildconfig.get('factory_install_mod', True): | 527 if buildconfig.get('factory_install_mod', True): |
526 cmd.append('--factory_install_mod') | 528 cmd.append('--factory_install_mod') |
527 | 529 |
528 if buildconfig.get('factory_test_mod', True): | 530 if buildconfig.get('factory_test_mod', True): |
529 cmd.append('--factory_test_mod') | 531 cmd.append('--factory_test_mod') |
530 | 532 |
531 if debug: | 533 if debug: |
532 Warning('***** ***** LegacyArchiveBuild CMD: ' + ' '.join(cmd)) | 534 Warning('***** ***** LegacyArchiveBuild CMD: ' + ' '.join(cmd)) |
533 else: | 535 else: |
534 RunCommand(cmd) | 536 RunCommand(cmd, cwd=cwd) |
535 | 537 |
536 def _ArchiveTestResults(buildroot, board, test_results_dir, | 538 def _ArchiveTestResults(buildroot, board, test_results_dir, |
537 gsutil, archive_dir, acl): | 539 gsutil, archive_dir, acl): |
538 """Archives the test results into Google Storage | 540 """Archives the test results into Google Storage |
539 | 541 |
540 Takes the results from the test_results_dir and the last qemu image and | 542 Takes the results from the test_results_dir and the last qemu image and |
541 uploads them to Google Storage. | 543 uploads them to Google Storage. |
542 | 544 |
543 Arguments: | 545 Arguments: |
544 buildroot: Root directory where build occurs | 546 buildroot: Root directory where build occurs |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 push_overlays, options.debug) | 793 push_overlays, options.debug) |
792 else: | 794 else: |
793 Die('CBUILDBOT - One of the slaves has failed!!!') | 795 Die('CBUILDBOT - One of the slaves has failed!!!') |
794 | 796 |
795 else: | 797 else: |
796 # Publish my status to the master if its expecting it. | 798 # Publish my status to the master if its expecting it. |
797 if buildconfig['important'] and not options.debug: | 799 if buildconfig['important'] and not options.debug: |
798 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) | 800 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) |
799 | 801 |
800 if buildconfig['archive_build']: | 802 if buildconfig['archive_build']: |
801 _LegacyArchiveBuild(bot_id, | 803 _LegacyArchiveBuild(buildroot, |
| 804 bot_id, |
802 buildconfig, | 805 buildconfig, |
803 options.buildnumber, | 806 options.buildnumber, |
804 options.debug) | 807 options.debug) |
805 except: | 808 except: |
806 # Send failure to master bot. | 809 # Send failure to master bot. |
807 if not buildconfig['master'] and buildconfig['important']: | 810 if not buildconfig['master'] and buildconfig['important']: |
808 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 811 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
809 | 812 |
810 raise | 813 raise |
811 | 814 |
812 | 815 |
813 if __name__ == '__main__': | 816 if __name__ == '__main__': |
814 main() | 817 main() |
OLD | NEW |