Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / chromite / cbuildbot / constants.py
1 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """This module contains constants used by cbuildbot and related code."""
6
7 from __future__ import print_function
8
9 import os
10
11 def _FindSourceRoot():
12   """Try and find the root check out of the chromiumos tree"""
13   source_root = path = os.path.realpath(os.path.join(
14       os.path.abspath(__file__), '..', '..', '..'))
15   while True:
16     if os.path.isdir(os.path.join(path, '.repo')):
17       return path
18     elif path == '/':
19       break
20     path = os.path.dirname(path)
21   return source_root
22
23 SOURCE_ROOT = _FindSourceRoot()
24 CHROOT_SOURCE_ROOT = '/mnt/host/source'
25
26 CROSUTILS_DIR = os.path.join(SOURCE_ROOT, 'src/scripts')
27 CHROMITE_DIR = os.path.join(SOURCE_ROOT, 'chromite')
28 DEPOT_TOOLS_DIR = os.path.join(SOURCE_ROOT, 'chromium/tools/depot_tools')
29 CHROMITE_BIN_SUBDIR = 'chromite/bin'
30 CHROMITE_BIN_DIR = os.path.join(SOURCE_ROOT, CHROMITE_BIN_SUBDIR)
31 PATH_TO_CBUILDBOT = os.path.join(CHROMITE_BIN_SUBDIR, 'cbuildbot')
32 DEFAULT_CHROOT_DIR = 'chroot'
33 SDK_TOOLCHAINS_OUTPUT = 'tmp/toolchain-pkgs'
34 AUTOTEST_BUILD_PATH = 'usr/local/build/autotest'
35
36 HOME_DIRECTORY = os.path.expanduser('~')
37
38 # If cbuiltbot is running on a bot, then the cidb access credentials will be
39 # available here. This directory will not exist otherwise.
40 CIDB_PROD_BOT_CREDS = os.path.join(HOME_DIRECTORY, '.cidb_creds',
41                                    'prod_cidb_bot')
42 CIDB_DEBUG_BOT_CREDS = os.path.join(HOME_DIRECTORY, '.cidb_creds',
43                                     'debug_cidb_bot')
44
45
46 # TODO: Eliminate these or merge with manifest_version.py:STATUS_PASSED
47 # crbug.com/318930
48 FINAL_STATUS_PASSED = 'passed'
49 FINAL_STATUS_FAILED = 'failed'
50
51 # Re-execution API constants.
52 # Used by --resume and --bootstrap to decipher which options they
53 # can pass to the target cbuildbot (since it may not have that
54 # option).
55 # Format is Major:Minor.  Minor is used for tracking new options added
56 # that aren't critical to the older version if it's not ran.
57 # Major is used for tracking heavy API breakage- for example, no longer
58 # supporting the --resume option.
59 REEXEC_API_MAJOR = 0
60 REEXEC_API_MINOR = 3
61 REEXEC_API_VERSION = '%i.%i' % (REEXEC_API_MAJOR, REEXEC_API_MINOR)
62
63 # Minor version 3 is the first to support --master-build-id
64 REEXEC_API_MASTER_BUILD_ID = 3
65
66 # We rely on the (waterfall, builder name, build number) to uniquely identify
67 # a build. However, future migrations or state wipes of the buildbot master may
68 # cause it to reset its build number counter. When that happens, this value
69 # should be incremented, ensuring that (waterfall, builder name, build number,
70 # buildbot generation) is a unique identifier of builds.
71 BUILDBOT_GENERATION = 1
72
73 ISOLATESERVER = 'https://isolateserver.appspot.com'
74
75 GOOGLE_EMAIL = '@google.com'
76 CHROMIUM_EMAIL = '@chromium.org'
77
78 CORP_DOMAIN = 'corp.google.com'
79 GOLO_DOMAIN = 'golo.chromium.org'
80 CHROME_DOMAIN = 'chrome.' + CORP_DOMAIN
81
82 GOB_HOST = '%s.googlesource.com'
83
84 EXTERNAL_GOB_INSTANCE = 'chromium'
85 EXTERNAL_GERRIT_INSTANCE = 'chromium-review'
86 EXTERNAL_GOB_HOST = GOB_HOST % EXTERNAL_GOB_INSTANCE
87 EXTERNAL_GERRIT_HOST = GOB_HOST % EXTERNAL_GERRIT_INSTANCE
88 EXTERNAL_GOB_URL = 'https://%s' % EXTERNAL_GOB_HOST
89 EXTERNAL_GERRIT_URL = 'https://%s' % EXTERNAL_GERRIT_HOST
90
91 INTERNAL_GOB_INSTANCE = 'chrome-internal'
92 INTERNAL_GERRIT_INSTANCE = 'chrome-internal-review'
93 INTERNAL_GOB_HOST = GOB_HOST % INTERNAL_GOB_INSTANCE
94 INTERNAL_GERRIT_HOST = GOB_HOST % INTERNAL_GERRIT_INSTANCE
95 INTERNAL_GOB_URL = 'https://%s' % INTERNAL_GOB_HOST
96 INTERNAL_GERRIT_URL = 'https://%s' % INTERNAL_GERRIT_HOST
97
98 REPO_PROJECT = 'external/repo'
99 REPO_URL = '%s/%s' % (EXTERNAL_GOB_URL, REPO_PROJECT)
100
101 CHROMITE_PROJECT = 'chromiumos/chromite'
102 CHROMITE_URL = '%s/%s' % (EXTERNAL_GOB_URL, CHROMITE_PROJECT)
103 CHROMIUM_SRC_PROJECT = 'chromium/src'
104 CHROMIUM_GOB_URL = '%s/%s.git' % (EXTERNAL_GOB_URL, CHROMIUM_SRC_PROJECT)
105 CHROME_INTERNAL_PROJECT = 'chrome/src-internal'
106 CHROME_INTERNAL_GOB_URL = '%s/%s.git' % (
107     INTERNAL_GOB_URL, CHROME_INTERNAL_PROJECT)
108
109 MANIFEST_PROJECT = 'chromiumos/manifest'
110 MANIFEST_INT_PROJECT = 'chromeos/manifest-internal'
111 MANIFEST_PROJECTS = (MANIFEST_PROJECT, MANIFEST_INT_PROJECT)
112
113 MANIFEST_URL = '%s/%s' % (EXTERNAL_GOB_URL, MANIFEST_PROJECT)
114 MANIFEST_INT_URL = '%s/%s' % (INTERNAL_GERRIT_URL, MANIFEST_INT_PROJECT)
115
116 DEFAULT_MANIFEST = 'default.xml'
117 OFFICIAL_MANIFEST = 'official.xml'
118 SHARED_CACHE_ENVVAR = 'CROS_CACHEDIR'
119
120 # CrOS remotes specified in the manifests.
121 EXTERNAL_REMOTE = 'cros'
122 INTERNAL_REMOTE = 'cros-internal'
123 CHROMIUM_REMOTE = 'chromium'
124 CHROME_REMOTE = 'chrome'
125
126 GERRIT_HOSTS = {
127     EXTERNAL_REMOTE: EXTERNAL_GERRIT_HOST,
128     INTERNAL_REMOTE: INTERNAL_GERRIT_HOST,
129 }
130
131 CROS_REMOTES = {
132     EXTERNAL_REMOTE: EXTERNAL_GOB_URL,
133     INTERNAL_REMOTE: INTERNAL_GOB_URL,
134 }
135
136 GIT_REMOTES = {
137     CHROMIUM_REMOTE: EXTERNAL_GOB_URL,
138     CHROME_REMOTE: INTERNAL_GOB_URL,
139 }
140 GIT_REMOTES.update(CROS_REMOTES)
141
142 # Prefix to distinguish internal and external changes. This is used
143 # when user specifies a patch with "-g", when generating a key for
144 # a patch to used in our PatchCache, and when display a custom string
145 # for the patch.
146 INTERNAL_CHANGE_PREFIX = '*'
147 EXTERNAL_CHANGE_PREFIX = ''
148
149 CHANGE_PREFIX = {
150     INTERNAL_REMOTE: INTERNAL_CHANGE_PREFIX,
151     EXTERNAL_REMOTE: EXTERNAL_CHANGE_PREFIX,
152 }
153
154 # List of remotes that are ok to include in the external manifest.
155 EXTERNAL_REMOTES = (EXTERNAL_REMOTE, CHROMIUM_REMOTE)
156
157 # Mapping 'remote name' -> regexp that matches names of repositories on that
158 # remote that can be branched when creating CrOS branch. Branching script will
159 # actually create a new git ref when branching these projects. It won't attempt
160 # to create a git ref for other projects that may be mentioned in a manifest.
161 BRANCHABLE_PROJECTS = {
162     EXTERNAL_REMOTE: r'chromiumos/(.+)',
163     INTERNAL_REMOTE: r'chromeos/(.+)',
164 }
165
166 # TODO(sosa): Move to manifest-versions-external once its created
167 MANIFEST_VERSIONS_SUFFIX = '/chromiumos/manifest-versions'
168 MANIFEST_VERSIONS_INT_SUFFIX = '/chromeos/manifest-versions'
169 MANIFEST_VERSIONS_GS_URL = 'gs://chromeos-manifest-versions'
170 TRASH_BUCKET = 'gs://chromeos-throw-away-bucket'
171
172 STREAK_COUNTERS = 'streak_counters'
173
174 PATCH_BRANCH = 'patch_branch'
175 STABLE_EBUILD_BRANCH = 'stabilizing_branch'
176 MERGE_BRANCH = 'merge_branch'
177
178 # These branches are deleted at the beginning of every buildbot run.
179 CREATED_BRANCHES = [
180     PATCH_BRANCH,
181     STABLE_EBUILD_BRANCH,
182     MERGE_BRANCH
183 ]
184
185 # Constants for uprevving Chrome
186
187 # Portage category and package name for Chrome.
188 CHROME_PN = 'chromeos-chrome'
189 CHROME_CP = 'chromeos-base/%s' % CHROME_PN
190
191 # Other packages to uprev while uprevving Chrome.
192 OTHER_CHROME_PACKAGES = ['chromeos-base/chromium-source']
193
194 # Chrome use flags
195 USE_CHROME_INTERNAL = 'chrome_internal'
196 USE_AFDO_USE = 'afdo_use'
197
198
199 # Builds and validates _alpha ebuilds.  These builds sync to the latest
200 # revsion of the Chromium src tree and build with that checkout.
201 CHROME_REV_TOT = 'tot'
202
203 # Builds and validates chrome at a given revision through cbuildbot
204 # --chrome_version
205 CHROME_REV_SPEC = 'spec'
206
207 # Builds and validates the latest Chromium release as defined by
208 # ~/trunk/releases in the Chrome src tree.  These ebuilds are suffixed with rc.
209 CHROME_REV_LATEST = 'latest_release'
210
211 # Builds and validates the latest Chromium release for a specific Chromium
212 # branch that we want to watch.  These ebuilds are suffixed with rc.
213 CHROME_REV_STICKY = 'stable_release'
214
215 # Builds and validates Chromium for a pre-populated directory.
216 # Also uses _alpha, since portage doesn't have anything lower.
217 CHROME_REV_LOCAL = 'local'
218 VALID_CHROME_REVISIONS = [CHROME_REV_TOT, CHROME_REV_LATEST,
219                           CHROME_REV_STICKY, CHROME_REV_LOCAL, CHROME_REV_SPEC]
220
221
222 # Build types supported.
223
224 # TODO(sosa): Deprecate PFQ type.
225 # Incremental builds that are built using binary packages when available.
226 # These builds have less validation than other build types.
227 INCREMENTAL_TYPE = 'binary'
228
229 # These builds serve as PFQ builders.  This is being deprecated.
230 PFQ_TYPE = 'pfq'
231
232 # Hybrid Commit and PFQ type.  Ultimate protection.  Commonly referred to
233 # as simply "commit queue" now.
234 PALADIN_TYPE = 'paladin'
235
236 # A builder that kicks off Pre-CQ builders that bless the purest CLs.
237 PRE_CQ_LAUNCHER_TYPE = 'priest'
238
239 # A builder that cuts and prunes branches.
240 CREATE_BRANCH_TYPE = 'gardener'
241
242 # Chrome PFQ type.  Incremental build type that builds and validates new
243 # versions of Chrome.  Only valid if set with CHROME_REV.  See
244 # VALID_CHROME_REVISIONS for more information.
245 CHROME_PFQ_TYPE = 'chrome'
246
247 # Builds from source and non-incremental.  This builds fully wipe their
248 # chroot before the start of every build and no not use a BINHOST.
249 BUILD_FROM_SOURCE_TYPE = 'full'
250
251 # Full but with versioned logic.
252 CANARY_TYPE = 'canary'
253
254 # Generate payloads for an already built build/version.
255 PAYLOADS_TYPE = 'payloads'
256
257 BRANCH_UTIL_CONFIG = 'branch-util'
258
259 # Special build type for Chroot builders.  These builds focus on building
260 # toolchains and validate that they work.
261 CHROOT_BUILDER_TYPE = 'chroot'
262 CHROOT_BUILDER_BOARD = 'amd64-host'
263
264 # Build that refreshes the online Portage package status spreadsheet.
265 REFRESH_PACKAGES_TYPE = 'refresh_packages'
266
267 VALID_BUILD_TYPES = (
268     PALADIN_TYPE,
269     INCREMENTAL_TYPE,
270     BUILD_FROM_SOURCE_TYPE,
271     CANARY_TYPE,
272     CHROOT_BUILDER_TYPE,
273     CHROOT_BUILDER_BOARD,
274     CHROME_PFQ_TYPE,
275     PFQ_TYPE,
276     PRE_CQ_LAUNCHER_TYPE,
277     REFRESH_PACKAGES_TYPE,
278     CREATE_BRANCH_TYPE,
279     PAYLOADS_TYPE,
280 )
281
282 # The name of the builder used to launch the pre-CQ.
283 PRE_CQ_BUILDER_NAME = 'pre-cq-group'
284
285 # The name of the Pre-CQ launcher on the waterfall.
286 PRE_CQ_LAUNCHER_NAME = 'Pre-CQ Launcher'
287
288 # Define pool of machines for Hardware tests.
289 HWTEST_DEFAULT_NUM = 6
290 HWTEST_TRYBOT_NUM = 3
291 HWTEST_MACH_POOL = 'bvt'
292 HWTEST_PALADIN_POOL = 'cq'
293 HWTEST_TOT_PALADIN_POOL = 'tot-cq'
294 HWTEST_PFQ_POOL = 'pfq'
295 HWTEST_SUITES_POOL = 'suites'
296 HWTEST_CHROME_PERF_POOL = 'chromeperf'
297 HWTEST_TRYBOT_POOL = 'try-bot'
298
299
300 # Defines for the various hardware test suites:
301 #   AU: Blocking suite run against all canaries; tests basic AU
302 #       functionality.
303 #   BVT:  Basic blocking suite to be run against any build that
304 #       requires a HWTest phase.
305 #   COMMIT:  Suite of basic tests required for commits to the source
306 #       tree.  Runs as a blocking suite on the CQ and PFQ; runs as
307 #       a non-blocking suite on canaries.
308 #   CANARY:  Non-blocking suite run only against the canaries.
309 #   AFDO:  Non-blocking suite run only AFDO builders.
310 HWTEST_AU_SUITE = 'au'
311 HWTEST_BVT_SUITE = 'bvt-inline'
312 HWTEST_COMMIT_SUITE = 'bvt-cq'
313 HWTEST_CANARY_SUITE = 'bvt-perbuild'
314 HWTEST_AFDO_SUITE = 'AFDO_record'
315
316
317 # Additional timeout to wait for autotest to abort a suite if the test takes
318 # too long to run. This is meant to be overly conservative as a timeout may
319 # indicate that autotest is at capacity.
320 HWTEST_TIMEOUT_EXTENSION = 10 * 60
321
322 HWTEST_DEFAULT_PRIORITY = 'DEFAULT'
323 HWTEST_CQ_PRIORITY = 'CQ'
324 HWTEST_BUILD_PRIORITY = 'Build'
325 HWTEST_PFQ_PRIORITY = 'PFQ'
326 HWTEST_POST_BUILD_PRIORITY = 'PostBuild'
327
328 # Ordered by priority (first item being lowest).
329 HWTEST_VALID_PRIORITIES = ['Weekly',
330                            'Daily',
331                            HWTEST_POST_BUILD_PRIORITY,
332                            HWTEST_DEFAULT_PRIORITY,
333                            HWTEST_BUILD_PRIORITY,
334                            HWTEST_PFQ_PRIORITY,
335                            HWTEST_CQ_PRIORITY]
336
337 # Creates a mapping of priorities to make easy comparsions.
338 HWTEST_PRIORITIES_MAP = dict(
339     (p, i) for i, p in enumerate(HWTEST_VALID_PRIORITIES))
340
341 # Defines VM Test types.
342 FULL_AU_TEST_TYPE = 'full_suite'
343 SIMPLE_AU_TEST_TYPE = 'pfq_suite'
344 SMOKE_SUITE_TEST_TYPE = 'smoke_suite'
345 TELEMETRY_SUITE_TEST_TYPE = 'telemetry_suite'
346 CROS_VM_TEST_TYPE = 'cros_vm_test'
347 DEV_MODE_TEST_TYPE = 'dev_mode_test'
348 VALID_VM_TEST_TYPES = [FULL_AU_TEST_TYPE, SIMPLE_AU_TEST_TYPE,
349                        SMOKE_SUITE_TEST_TYPE, TELEMETRY_SUITE_TEST_TYPE,
350                        CROS_VM_TEST_TYPE, DEV_MODE_TEST_TYPE]
351
352 CHROMIUMOS_OVERLAY_DIR = 'src/third_party/chromiumos-overlay'
353 VERSION_FILE = os.path.join(CHROMIUMOS_OVERLAY_DIR,
354                             'chromeos/config/chromeos_version.sh')
355 SDK_VERSION_FILE = os.path.join(CHROMIUMOS_OVERLAY_DIR,
356                                 'chromeos/binhost/host/sdk_version.conf')
357 SDK_GS_BUCKET = 'chromiumos-sdk'
358
359 PUBLIC = 'public'
360 PRIVATE = 'private'
361
362 BOTH_OVERLAYS = 'both'
363 PUBLIC_OVERLAYS = PUBLIC
364 PRIVATE_OVERLAYS = PRIVATE
365 VALID_OVERLAYS = [BOTH_OVERLAYS, PUBLIC_OVERLAYS, PRIVATE_OVERLAYS, None]
366
367 # Common default logging settings for use with the logging module.
368 LOGGER_FMT = '%(asctime)s: %(levelname)s: %(message)s'
369 LOGGER_DATE_FMT = '%H:%M:%S'
370
371 # Used by remote patch serialization/deserialzation.
372 INTERNAL_PATCH_TAG = 'i'
373 EXTERNAL_PATCH_TAG = 'e'
374 PATCH_TAGS = (INTERNAL_PATCH_TAG, EXTERNAL_PATCH_TAG)
375
376 # Tree status strings
377 TREE_OPEN = 'open'
378 TREE_THROTTLED = 'throttled'
379 TREE_CLOSED = 'closed'
380 TREE_MAINTENANCE = 'maintenance'
381 # The statuses are listed in the order of increasing severity.
382 VALID_TREE_STATUSES = (TREE_OPEN, TREE_THROTTLED, TREE_CLOSED, TREE_MAINTENANCE)
383
384
385 _GERRIT_QUERY_TEMPLATE = ('status:open AND '
386                           'label:Code-Review=+2 AND '
387                           'label:Verified=+1 AND '
388                           'label:Commit-Queue>=%+i AND '
389                           'NOT ( label:CodeReview=-2 OR label:Verified=-1 OR '
390                           'is:draft )')
391
392 # Default gerrit query used to find changes for CQ.
393 # Permits CQ+1 or CQ+2 changes.
394 DEFAULT_CQ_READY_QUERY = _GERRIT_QUERY_TEMPLATE % 1
395
396 # Gerrit query used to find changes for CQ when tree is throttled.
397 # Permits only CQ+2 changes.
398 THROTTLED_CQ_READY_QUERY = _GERRIT_QUERY_TEMPLATE % 2
399
400 # Default filter rules for verifying that Gerrit returned results that matched
401 # our query. This used for working around Gerrit bugs.
402 DEFAULT_CQ_READY_FIELDS = {
403     'CRVW': '2',
404     'VRIF': '1',
405     'COMR': ('1', '2'),
406 }
407
408 DEFAULT_CQ_SHOULD_REJECT_FIELDS = {
409     'CRVW': '-2',
410     'VRIF': '-1',
411 }
412
413 GERRIT_ON_BORG_LABELS = {
414     'Code-Review': 'CRVW',
415     'Commit-Queue': 'COMR',
416     'Verified': 'VRIF',
417     'Trybot-Verified': 'TBVF',
418 }
419
420 # Actions that a CQ run can take on a CL
421 CL_ACTION_PICKED_UP = 'picked_up'         # CL picked up in CommitQueueSync
422 CL_ACTION_SUBMITTED = 'submitted'         # CL submitted successfully
423 CL_ACTION_KICKED_OUT = 'kicked_out'       # CL CQ-Ready value set to zero
424 CL_ACTION_SUBMIT_FAILED = 'submit_failed' # CL submitted but submit failed
425 CL_ACTION_VERIFIED = 'verified'           # CL was verified by the builder
426
427 # Actions the Pre-CQ Launcher can take on a CL
428 # See cbuildbot/stages/sync_stages.py:PreCQLauncherStage for more info
429 CL_ACTION_PRE_CQ_INFLIGHT = 'pre_cq_inflight'
430 CL_ACTION_PRE_CQ_PASSED = 'pre_cq_passed'
431 CL_ACTION_PRE_CQ_FAILED = 'pre_cq_failed'
432 CL_ACTION_PRE_CQ_LAUNCHING = 'pre_cq_launching'
433 CL_ACTION_PRE_CQ_WAITING = 'pre_cq_waiting'
434 CL_ACTION_PRE_CQ_READY_TO_SUBMIT = 'pre_cq_ready_to_submit'
435
436 CL_ACTIONS = [CL_ACTION_PICKED_UP,
437               CL_ACTION_SUBMITTED,
438               CL_ACTION_KICKED_OUT,
439               CL_ACTION_SUBMIT_FAILED,
440               CL_ACTION_VERIFIED,
441               CL_ACTION_PRE_CQ_INFLIGHT,
442               CL_ACTION_PRE_CQ_PASSED,
443               CL_ACTION_PRE_CQ_FAILED,
444               CL_ACTION_PRE_CQ_LAUNCHING,
445               CL_ACTION_PRE_CQ_WAITING,
446               CL_ACTION_PRE_CQ_READY_TO_SUBMIT]
447
448 # CQ types.
449 CQ = 'cq'
450 PRE_CQ = 'pre-cq'
451
452 # Environment variables that should be exposed to all children processes
453 # invoked via cros_build_lib.RunCommand.
454 ENV_PASSTHRU = ('CROS_SUDO_KEEP_ALIVE', SHARED_CACHE_ENVVAR)
455
456 # List of variables to proxy into the chroot from the host, and to
457 # have sudo export if existent. Anytime this list is modified, a new
458 # chroot_version_hooks.d upgrade script that symlinks to 45_rewrite_sudoers.d
459 # should be created.
460 CHROOT_ENVIRONMENT_WHITELIST = (
461   'CHROMEOS_OFFICIAL',
462   'CHROMEOS_VERSION_AUSERVER',
463   'CHROMEOS_VERSION_DEVSERVER',
464   'CHROMEOS_VERSION_TRACK',
465   'GCC_GITHASH',
466   'GIT_AUTHOR_EMAIL',
467   'GIT_AUTHOR_NAME',
468   'GIT_COMMITTER_EMAIL',
469   'GIT_COMMITTER_NAME',
470   'GIT_PROXY_COMMAND',
471   'GIT_SSH',
472   'RSYNC_PROXY',
473   'SSH_AGENT_PID',
474   'SSH_AUTH_SOCK',
475   'USE',
476   'all_proxy',
477   'ftp_proxy',
478   'http_proxy',
479   'https_proxy',
480   'no_proxy',
481 )
482
483 # Paths for Chrome LKGM which are relative to the Chromium base url.
484 CHROME_LKGM_FILE = 'CHROMEOS_LKGM'
485 PATH_TO_CHROME_LKGM = 'chromeos/%s' % CHROME_LKGM_FILE
486 SVN_CHROME_LKGM = 'trunk/src/%s' % PATH_TO_CHROME_LKGM
487
488 # Cache constants.
489 COMMON_CACHE = 'common'
490
491 # Artifact constants.
492 def _SlashToUnderscore(string):
493   return string.replace('/', '_')
494
495 DEFAULT_ARCHIVE_BUCKET = 'gs://chromeos-image-archive'
496 RELEASE_BUCKET = 'gs://chromeos-releases'
497 TRASH_BUCKET = 'gs://chromeos-throw-away-bucket'
498 CHROME_SYSROOT_TAR = 'sysroot_%s.tar.xz' % _SlashToUnderscore(CHROME_CP)
499 CHROME_ENV_TAR = 'environment_%s.tar.xz' % _SlashToUnderscore(CHROME_CP)
500 CHROME_ENV_FILE = 'environment'
501 BASE_IMAGE_NAME = 'chromiumos_base_image'
502 BASE_IMAGE_TAR = '%s.tar.xz' % BASE_IMAGE_NAME
503 BASE_IMAGE_BIN = '%s.bin' % BASE_IMAGE_NAME
504 IMAGE_SCRIPTS_NAME = 'image_scripts'
505 IMAGE_SCRIPTS_TAR = '%s.tar.xz' % IMAGE_SCRIPTS_NAME
506 VM_IMAGE_NAME = 'chromiumos_qemu_image'
507 VM_IMAGE_BIN = '%s.bin' % VM_IMAGE_NAME
508 VM_DISK_PREFIX = 'chromiumos_qemu_disk.bin'
509 VM_MEM_PREFIX = 'chromiumos_qemu_mem.bin'
510 VM_TEST_RESULTS = 'vm_test_results_%(attempt)s'
511
512 METADATA_JSON = 'metadata.json'
513 PARTIAL_METADATA_JSON = 'partial-metadata.json'
514 DELTA_SYSROOT_TAR = 'delta_sysroot.tar.xz'
515 DELTA_SYSROOT_BATCH = 'batch'
516
517 # Global configuration constants.
518 CHROMITE_CONFIG_DIR = os.path.expanduser('~/.chromite')
519 CHROME_SDK_BASHRC = os.path.join(CHROMITE_CONFIG_DIR, 'chrome_sdk.bashrc')
520 SYNC_RETRIES = 2
521 SLEEP_TIMEOUT = 30
522
523 # Lab status url.
524 LAB_STATUS_URL = 'http://chromiumos-lab.appspot.com/current?format=json'
525
526 GOLO_SMTP_SERVER = 'mail.golo.chromium.org'
527
528 # URLs to the various waterfalls.
529 BUILD_DASHBOARD = 'http://build.chromium.org/p/chromiumos'
530 BUILD_INT_DASHBOARD = 'https://uberchromegw.corp.google.com/i/chromeos'
531 TRYBOT_DASHBOARD = 'https://uberchromegw.corp.google.com/i/chromiumos.tryserver'
532
533 # Valid sherrif types.
534 TREE_SHERIFF = 'tree'
535 BUILD_DEPUTY = 'build'
536 LAB_SHERIFF = 'lab'
537 CHROME_GARDENER = 'chrome'
538
539 # URLs to retrieve sheriff names from the waterfall.
540 TREE_SHERIFF_URL = '%s/sheriff.js' % (BUILD_DASHBOARD)
541 TREE_SHERIFF2_URL = '%s/sheriff2.js' % (BUILD_DASHBOARD)
542 BUILD_DEPUTY_URL = '%s/chromeos_build_deputy.js' % (BUILD_DASHBOARD)
543 LAB_SHERIFF_URL = '%s/sheriff_cros_lab.js' % (BUILD_DASHBOARD)
544 CHROME_GARDENER_URL = '%s/sheriff_cr_cros_gardeners.js' % (BUILD_DASHBOARD)
545
546 SHERIFF_TYPE_TO_URL = {
547     TREE_SHERIFF: (TREE_SHERIFF_URL, TREE_SHERIFF2_URL),
548     BUILD_DEPUTY: (BUILD_DEPUTY_URL,),
549     LAB_SHERIFF: (LAB_SHERIFF_URL,),
550     CHROME_GARDENER: (CHROME_GARDENER_URL)
551 }
552
553
554 # Useful config targets.
555 CQ_MASTER = 'master-paladin'
556
557 # Useful google storage locations.
558 PRE_CQ_GROUP_GS_LOCATION = 'trybot-pre-cq-group'
559
560 # Email validation regex. Not quite fully compliant with RFC 2822, but good
561 # approximation.
562 EMAIL_REGEX = r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}'
563
564 # Blacklist of files not allowed to be uploaded into the Partner Project Google
565 # Storage Buckets:
566 # debug.tgz contains debug symbols.
567 # manifest.xml exposes all of our repo names.
568 # vm_test_results can contain symbolicated crash dumps.
569 EXTRA_BUCKETS_FILES_BLACKLIST = [
570     'debug.tgz',
571     'manifest.xml',
572     'vm_test_results_*'
573 ]
574
575 # AFDO common constants.
576 # How long does the AFDO_record autotest have to generate the AFDO perf data.
577 AFDO_GENERATE_TIMEOUT = 90 * 60