OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2014 The Chromium 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 """Steps to archive dartium, content_shell, and chromedriver from buildbots. | 7 """Steps to archive dartium, content_shell, and chromedriver from buildbots. |
8 | 8 |
9 Imported by buildbot_annotated_steps.py and multivm_archive.py | 9 Imported by buildbot_annotated_steps.py and multivm_archive.py |
10 """ | 10 """ |
11 | 11 |
12 import imp | 12 import imp |
13 import os | 13 import os |
14 import platform | 14 import platform |
15 import re | 15 import re |
16 import subprocess | 16 import subprocess |
17 import sys | 17 import sys |
18 | 18 |
19 import dartium_bot_utils | 19 import dartium_bot_utils |
20 import archive | 20 import archive |
21 | 21 |
22 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' | 22 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' |
23 REVISION = 'BUILDBOT_REVISION' | 23 REVISION = 'BUILDBOT_REVISION' |
24 BUILDER_PATTERN = (r'^(dartium|multivm)-(mac|lucid64|lucid32|win)' | 24 BUILDER_PATTERN = (r'^(dartium)-(mac|lucid64|lucid32|win)' |
25 r'-(full|inc|debug|build)(-ninja)?(-(be|dev|stable|integration))?$') | 25 r'-(full|inc|debug)(-ninja)?(-(be|dev|stable|integration))?$') |
26 NEW_BUILDER_PATTERN = ( | |
27 r'^dartium-(mac|linux|win)-(ia32|x64)(-inc)?-(be|dev|stable|integration)$') | |
26 | 28 |
27 if platform.system() == 'Windows': | 29 if platform.system() == 'Windows': |
28 GSUTIL = 'e:/b/build/scripts/slave/gsutil.bat' | 30 GSUTIL = 'e:/b/build/scripts/slave/gsutil.bat' |
29 else: | 31 else: |
30 GSUTIL = '/b/build/scripts/slave/gsutil' | 32 GSUTIL = '/b/build/scripts/slave/gsutil' |
31 ACL = 'public-read' | 33 ACL = 'public-read' |
32 GS_SITE = 'gs://' | 34 GS_SITE = 'gs://' |
33 GS_URL = 'https://sandbox.google.com/storage/' | 35 GS_URL = 'https://sandbox.google.com/storage/' |
34 GS_DIR = 'dartium-archive' | 36 GS_DIR = 'dartium-archive' |
35 LATEST = 'latest' | 37 LATEST = 'latest' |
36 CONTINUOUS = 'continuous' | 38 CONTINUOUS = 'continuous' |
37 | 39 |
38 SRC_PATH = dartium_bot_utils.srcPath() | 40 SRC_PATH = dartium_bot_utils.srcPath() |
39 DART_PATH = os.path.join(SRC_PATH, 'dart') | 41 DART_PATH = os.path.join(SRC_PATH, 'dart') |
40 | 42 |
41 bot_utils = imp.load_source('bot_utils', | 43 bot_utils = imp.load_source('bot_utils', |
42 os.path.join(DART_PATH, 'tools', 'bots', 'bot_utils.py')) | 44 os.path.join(DART_PATH, 'tools', 'bots', 'bot_utils.py')) |
43 | 45 |
44 class BuildInfo(object): | 46 class BuildInfo(object): |
45 """ | 47 """ |
46 name: A name for the build - the buildbot host if a buildbot. | 48 name: A name for the build - the buildbot host if a buildbot. |
47 mode: 'Debug' or 'Release' | 49 mode: 'Debug' or 'Release' |
48 arch: target architecture | 50 arch: target architecture |
49 channel: the channel this build is happening on | 51 channel: the channel this build is happening on |
50 is_full: True if this is a full build. | 52 is_full: True if this is a full build. |
51 is_incremental: True if this is an incremental build. | 53 is_incremental: True if this is an incremental build. |
52 is_build: True if this is a builder for the performance testers. | |
53 is_win_ninja: True if this is a ninja build on Windows. | |
54 | 54 |
55 """ | 55 """ |
56 def __init__(self, revision, version): | 56 def __init__(self, revision, version): |
57 | 57 |
58 self.revision = revision | 58 self.revision = revision |
59 self.version = version | 59 self.version = version |
60 # Populate via builder environment variables. | |
61 self.name = os.environ[BUILDER_NAME] | 60 self.name = os.environ[BUILDER_NAME] |
62 # Temporary hack, until we rename the FYI bots. | 61 pattern = re.match(NEW_BUILDER_PATTERN, self.name) |
63 # We should eventually rename all to linux32 and linux64. | 62 if pattern: |
64 self.name = self.name.replace('-linux-', '-lucid64-') | 63 self.arch = pattern.group(2) |
65 | 64 self.mode = 'Release' |
kustermann
2016/09/06 14:59:25
Why don't we have support for release/debug?
Bill Hesse
2016/09/06 15:32:55
Because we don't need it, we don't have debug bots
| |
66 self.is_incremental = '-inc' in self.name | 65 self.is_incremental = (pattern.group(3) == '-inc') |
67 self.is_win_ninja = 'win-inc-ninja' in self.name | 66 self.is_full = not self.is_incremental |
68 pattern = re.match(BUILDER_PATTERN, self.name) | 67 self.channel = pattern.group(4) |
69 assert pattern | 68 else: |
70 self.arch = 'x64' if pattern.group(2) == 'lucid64' else 'ia32' | 69 pattern = re.match(BUILDER_PATTERN, self.name) |
71 self.mode = 'Debug' if pattern.group(3) == 'debug' else 'Release' | 70 assert pattern: |
72 self.is_full = pattern.group(3) == 'full' | 71 self.arch = 'x64' if pattern.group(2) == 'lucid64' else 'ia32' |
73 self.is_build = pattern.group(3) == 'build' | 72 self.mode = 'Debug' if pattern.group(3) == 'debug' else 'Release' |
74 self.channel = pattern.group(6) if pattern.group(6) else 'be' | 73 self.is_incremental = '-inc' in self.name |
74 self.is_full = pattern.group(3) == 'full' | |
75 self.channel = pattern.group(6) if pattern.group(6) else 'be' | |
75 | 76 |
76 | 77 |
77 def ArchiveAndUpload(info, archive_latest=False): | 78 def ArchiveAndUpload(info, archive_latest=False): |
78 print '@@@BUILD_STEP dartium_generate_archive@@@' | 79 print '@@@BUILD_STEP dartium_generate_archive@@@' |
79 cwd = os.getcwd() | 80 cwd = os.getcwd() |
80 | 81 |
81 dartium_bucket = info.name | 82 dartium_bucket = info.name |
82 dartium_bucket = dartium_bucket.replace('multivm', 'multivm-dartium') | |
83 drt_bucket = dartium_bucket.replace('dartium', 'drt') | 83 drt_bucket = dartium_bucket.replace('dartium', 'drt') |
84 chromedriver_bucket = dartium_bucket.replace('dartium', 'chromedriver') | 84 chromedriver_bucket = dartium_bucket.replace('dartium', 'chromedriver') |
85 dartium_archive = dartium_bucket + '-' + info.version | 85 dartium_archive = dartium_bucket + '-' + info.version |
86 drt_archive = drt_bucket + '-' + info.version | 86 drt_archive = drt_bucket + '-' + info.version |
87 chromedriver_archive = chromedriver_bucket + '-' + info.version | 87 chromedriver_archive = chromedriver_bucket + '-' + info.version |
88 dartium_zip, drt_zip, chromedriver_zip = archive.Archive( | 88 dartium_zip, drt_zip, chromedriver_zip = archive.Archive( |
89 SRC_PATH, | 89 SRC_PATH, |
90 info.mode, | 90 info.mode, |
91 dartium_archive, | 91 dartium_archive, |
92 drt_archive, | 92 drt_archive, |
93 chromedriver_archive, | 93 chromedriver_archive, |
94 is_win_ninja=info.is_win_ninja) | 94 is_win_ninja=False) |
95 | 95 |
96 status = 0 | 96 status = 0 |
97 # Upload bleeding-edge builds to old dartium-archive bucket | 97 # Upload bleeding-edge builds to old dartium-archive bucket |
98 if info.channel == 'be': | 98 if info.channel == 'be': |
99 status = (OldUpload('dartium', dartium_bucket, | 99 status = (OldUpload('dartium', dartium_bucket, |
100 os.path.abspath(dartium_zip), | 100 os.path.abspath(dartium_zip), |
101 archive_latest=archive_latest) | 101 archive_latest=archive_latest) |
102 or OldUpload('drt', drt_bucket, | 102 or OldUpload('drt', drt_bucket, |
103 os.path.abspath(drt_zip), | 103 os.path.abspath(drt_zip), |
104 archive_latest=archive_latest) | 104 archive_latest=archive_latest) |
105 or OldUpload('chromedriver', chromedriver_bucket, | 105 or OldUpload('chromedriver', chromedriver_bucket, |
106 os.path.abspath(chromedriver_zip), | 106 os.path.abspath(chromedriver_zip), |
107 archive_latest=archive_latest)) | 107 archive_latest=archive_latest)) |
108 | 108 |
109 # Upload to new dart-archive bucket using GCSNamer, but not incremental | 109 # Upload to new dart-archive bucket using GCSNamer, but not incremental |
110 # or perf builder builds. | 110 # or perf builder builds. |
111 if not info.is_incremental and not info.is_build: | 111 if not info.is_incremental: |
112 Upload('dartium', os.path.abspath(dartium_zip), | 112 Upload('dartium', os.path.abspath(dartium_zip), |
113 info, archive_latest=archive_latest) | 113 info, archive_latest=archive_latest) |
114 Upload('drt', os.path.abspath(drt_zip), | 114 Upload('drt', os.path.abspath(drt_zip), |
115 info, archive_latest=archive_latest) | 115 info, archive_latest=archive_latest) |
116 Upload('chromedriver', os.path.abspath(chromedriver_zip), | 116 Upload('chromedriver', os.path.abspath(chromedriver_zip), |
117 info, archive_latest=archive_latest) | 117 info, archive_latest=archive_latest) |
118 | 118 |
119 os.chdir(cwd) | 119 os.chdir(cwd) |
120 if status != 0: | 120 if status != 0: |
121 print '@@@STEP_FAILURE@@@' | 121 print '@@@STEP_FAILURE@@@' |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 def RemoveArchives(archives): | 270 def RemoveArchives(archives): |
271 """Remove the list of archives in Google storage. | 271 """Remove the list of archives in Google storage. |
272 """ | 272 """ |
273 for archive in archives: | 273 for archive in archives: |
274 if archive.find(GS_SITE) == 0: | 274 if archive.find(GS_SITE) == 0: |
275 cmd = [GSUTIL, 'rm', archive.rstrip()] | 275 cmd = [GSUTIL, 'rm', archive.rstrip()] |
276 (status, _) = ExecuteCommand(cmd) | 276 (status, _) = ExecuteCommand(cmd) |
277 if status != 0: | 277 if status != 0: |
278 return status | 278 return status |
279 return 0 | 279 return 0 |
OLD | NEW |