• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- coding: utf-8 -*-
2# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""This module contains constants used by cbuildbot and related code."""
7
8from __future__ import print_function
9
10import itertools
11import os
12
13def _FindSourceRoot():
14    """Try and find the root check out of the chromiumos tree"""
15    source_root = path = os.path.realpath(
16            os.path.join(os.path.abspath(__file__), '..', '..', '..'))
17    while True:
18        if os.path.isdir(os.path.join(path, '.repo')):
19            return path
20        elif path == '/':
21            break
22        path = os.path.dirname(path)
23    return source_root
24
25
26SOURCE_ROOT = _FindSourceRoot()
27CHROOT_SOURCE_ROOT = '/mnt/host/source'
28CHROOT_CACHE_ROOT = '/var/cache/chromeos-cache'
29DEPOT_TOOLS_SUBPATH = 'src/chromium/depot_tools'
30
31CROSUTILS_DIR = os.path.join(SOURCE_ROOT, 'src/scripts')
32CHROMITE_DIR = os.path.realpath(os.path.join(
33    os.path.abspath(__file__), '..', '..'))
34BOOTSTRAP_DIR = os.path.join(CHROMITE_DIR, 'bootstrap')
35DEPOT_TOOLS_DIR = os.path.join(SOURCE_ROOT, DEPOT_TOOLS_SUBPATH)
36CHROMITE_BIN_SUBDIR = 'chromite/bin'
37CHROMITE_BIN_DIR = os.path.join(CHROMITE_DIR, 'bin')
38CHROMITE_SCRIPTS_DIR = os.path.join(CHROMITE_DIR, 'scripts')
39PATH_TO_CBUILDBOT = os.path.join(CHROMITE_BIN_SUBDIR, 'cbuildbot')
40DEFAULT_CHROOT_DIR = 'chroot'
41DEFAULT_CHROOT_PATH = os.path.join(SOURCE_ROOT, DEFAULT_CHROOT_DIR)
42TERMINA_TOOLS_DIR = os.path.join(
43    SOURCE_ROOT, 'src/platform/container-guest-tools/termina')
44
45STATEFUL_DIR = '/mnt/stateful_partition'
46
47# These constants are defined and used in the die_hook that logs failed
48# packages: 'cros_log_failed_packages' in profiles/base/profile.bashrc in
49# chromiumos-overlay. The status file is generated in CROS_METRICS_DIR, and
50# only if that environment variable is defined.
51CROS_METRICS_DIR_ENVVAR = 'CROS_METRICS_DIR'
52DIE_HOOK_STATUS_FILE_NAME = 'FAILED_PACKAGES'
53
54CHROMEOS_CONFIG_FILE = os.path.join(CHROMITE_DIR, 'config', 'config_dump.json')
55WATERFALL_CONFIG_FILE = os.path.join(
56    CHROMITE_DIR, 'config', 'waterfall_layout_dump.txt')
57LUCI_SCHEDULER_CONFIG_FILE = os.path.join(
58    CHROMITE_DIR, 'config', 'luci-scheduler.cfg')
59
60GE_BUILD_CONFIG_FILE = os.path.join(
61    CHROMITE_DIR, 'config', 'ge_build_config.json')
62
63# The following define the location for storing toolchain packages and
64# SDK overlay tarballs created during SDK builder runs. The paths are relative
65# to the build root's chroot, which guarantees that they are reachable from it
66# and get cleaned up when it is removed.
67SDK_TOOLCHAINS_OUTPUT = 'tmp/toolchain-pkgs'
68SDK_OVERLAYS_OUTPUT = 'tmp/sdk-overlays'
69
70AUTOTEST_BUILD_PATH = 'usr/local/build/autotest'
71UNITTEST_PKG_PATH = 'test-packages'
72
73# Only used for testing pinned images on test images.
74GUEST_IMAGES_PINS_PATH = 'usr/local/opt/google/containers/pins'
75PIN_KEY_FILENAME = 'filename'
76PIN_KEY_GSURI = 'gsuri'
77
78# Path to the lsb-release file on the device.
79LSB_RELEASE_PATH = '/etc/lsb-release'
80
81HOME_DIRECTORY = os.path.expanduser('~')
82
83# If cbuiltbot is running on a bot, then the cidb access credentials will be
84# available here. This directory will not exist otherwise.
85CIDB_PROD_BOT_CREDS = os.path.join(HOME_DIRECTORY, '.cidb_creds',
86                                   'prod_cidb_bot')
87CIDB_DEBUG_BOT_CREDS = os.path.join(HOME_DIRECTORY, '.cidb_creds',
88                                    'debug_cidb_bot')
89
90# Crash Server upload API key.
91CRASH_API_KEY = os.path.join('/', 'creds', 'api_keys',
92                             'api_key-chromeos-crash-uploader')
93
94# Buildbucket build status
95BUILDBUCKET_BUILDER_STATUS_SCHEDULED = 'SCHEDULED'
96BUILDBUCKET_BUILDER_STATUS_STARTED = 'STARTED'
97BUILDBUCKET_BUILDER_STATUS_COMPLETED = 'COMPLETED'
98
99BUILDBUCKET_BUILDER_STATUSES = (BUILDBUCKET_BUILDER_STATUS_SCHEDULED,
100                                BUILDBUCKET_BUILDER_STATUS_STARTED,
101                                BUILDBUCKET_BUILDER_STATUS_COMPLETED)
102
103BUILDBUCKET_BUILDER_RESULT_SUCCESS = 'SUCCESS'
104BUILDBUCKET_BUILDER_RESULT_FAILURE = 'FAILURE'
105BUILDBUCKET_BUILDER_RESULT_CANCELED = 'CANCELED'
106
107# Builder status strings
108BUILDER_STATUS_FAILED = 'fail'
109BUILDER_STATUS_PASSED = 'pass'
110BUILDER_STATUS_INFLIGHT = 'inflight'
111BUILDER_STATUS_MISSING = 'missing'
112BUILDER_STATUS_ABORTED = 'aborted'
113# The following statuses are currently only used for build stages.
114BUILDER_STATUS_PLANNED = 'planned'
115BUILDER_STATUS_WAITING = 'waiting'
116BUILDER_STATUS_SKIPPED = 'skipped'
117BUILDER_STATUS_FORGIVEN = 'forgiven'
118BUILDER_COMPLETED_STATUSES = (BUILDER_STATUS_PASSED,
119                              BUILDER_STATUS_FAILED,
120                              BUILDER_STATUS_ABORTED,
121                              BUILDER_STATUS_SKIPPED,
122                              BUILDER_STATUS_FORGIVEN)
123BUILDER_ALL_STATUSES = (BUILDER_STATUS_FAILED,
124                        BUILDER_STATUS_PASSED,
125                        BUILDER_STATUS_INFLIGHT,
126                        BUILDER_STATUS_MISSING,
127                        BUILDER_STATUS_ABORTED,
128                        BUILDER_STATUS_WAITING,
129                        BUILDER_STATUS_PLANNED,
130                        BUILDER_STATUS_SKIPPED,
131                        BUILDER_STATUS_FORGIVEN)
132BUILDER_NON_FAILURE_STATUSES = (BUILDER_STATUS_PLANNED,
133                                BUILDER_STATUS_PASSED,
134                                BUILDER_STATUS_SKIPPED,
135                                # Quick fix for Buildbucket race problems.
136                                BUILDER_STATUS_INFLIGHT,
137                                BUILDER_STATUS_FORGIVEN)
138
139# Partition labels
140CROS_PART_STATEFUL = 'STATE'
141
142# Signer status strings
143SIGNER_STATUS_PASSED = 'passed'
144SIGNER_STATUS_FAILED = 'failed'
145
146# Change sources
147CHANGE_SOURCE_INTERNAL = 'internal'
148CHANGE_SOURCE_EXTERNAL = 'external'
149
150# Exception categories, as recorded in cidb
151EXCEPTION_CATEGORY_UNKNOWN = 'unknown'
152EXCEPTION_CATEGORY_BUILD = 'build'
153EXCEPTION_CATEGORY_TEST = 'test'
154EXCEPTION_CATEGORY_INFRA = 'infra'
155EXCEPTION_CATEGORY_LAB = 'lab'
156
157EXCEPTION_CATEGORY_ALL_CATEGORIES = (
158    EXCEPTION_CATEGORY_UNKNOWN,
159    EXCEPTION_CATEGORY_BUILD,
160    EXCEPTION_CATEGORY_TEST,
161    EXCEPTION_CATEGORY_INFRA,
162    EXCEPTION_CATEGORY_LAB,
163)
164
165# Monarch metric names
166MON_LAST_SLAVE = 'chromeos/cbuildbot/last_completed_slave'
167MON_BUILD_COMP_COUNT = 'chromeos/cbuildbot/build/completed_count'
168MON_BUILD_DURATION = 'chromeos/cbuildbot/build/durations'
169MON_STAGE_COMP_COUNT = 'chromeos/cbuildbot/stage/completed_count'
170MON_STAGE_DURATION = 'chromeos/cbuildbot/stage/durations'
171MON_STAGE_INSTANCE_DURATION = 'chromeos/cbuildbot/stage/instance_durations'
172MON_STAGE_FAILURE_COUNT = 'chromeos/cbuildbot/stage/failure_count'
173MON_FAILED_STAGE = 'chromeos/chromite/cbuildbot_launch/failed_stage'
174MON_CHROOT_USED = 'chromeos/cbuildbot/chroot_at_version'
175MON_REPO_SYNC_COUNT = 'chromeos/cbuildbot/repo/sync_count'
176MON_REPO_SYNC_RETRY_COUNT = 'chromeos/cbuildbot/repo/sync_retry_count'
177MON_REPO_SELFUPDATE_FAILURE_COUNT = ('chromeos/cbuildbot/repo/'
178                                     'selfupdate_failure_count')
179MON_REPO_INIT_RETRY_COUNT = 'chromeos/cbuildbot/repo/init_retry_count'
180MON_REPO_MANIFEST_FAILURE_COUNT = ('chromeos/cbuildbot/repo/'
181                                   'manifest_failure_count')
182MON_BB_RETRY_BUILD_COUNT = ('chromeos/cbuildbot/buildbucket/'
183                            'retry_build_count')
184MON_BB_CANCEL_BATCH_BUILDS_COUNT = ('chromeos/cbuildbot/buildbucket/'
185                                    'cancel_batch_builds_count')
186MON_EXPORT_TO_GCLOUD = 'chromeos/cbuildbot/export_to_gcloud'
187
188# Stage Categorization for failed stages metric.
189UNCATEGORIZED_STAGE = 'Uncategorized'
190CI_INFRA_STAGE = 'CI-Infra'
191TEST_INFRA_STAGE = 'Test-Infra'
192PRODUCT_OS_STAGE = 'Product-OS'
193PRODUCT_ANDROID_STAGE = 'Product-Android'
194PRODUCT_CHROME_STAGE = 'Product-Chrome'
195PRODUCT_TOOLCHAIN_STAGE = 'Product-Toolchain'
196
197
198# Re-execution API constants.
199# Used by --resume and --bootstrap to decipher which options they
200# can pass to the target cbuildbot (since it may not have that
201# option).
202# Format is Major.Minor.  Minor is used for tracking new options added
203# that aren't critical to the older version if it's not ran.
204# Major is used for tracking heavy API breakage- for example, no longer
205# supporting the --resume option.
206REEXEC_API_MAJOR = 0
207REEXEC_API_MINOR = 12
208REEXEC_API_VERSION = '%i.%i' % (REEXEC_API_MAJOR, REEXEC_API_MINOR)
209
210# Support --master-build-id
211REEXEC_API_MASTER_BUILD_ID = 3
212# Support --git-cache-dir
213REEXEC_API_GIT_CACHE_DIR = 4
214# Support --goma_dir and --goma_client_json
215REEXEC_API_GOMA = 5
216# Support --ts-mon-task-num
217REEXEC_API_TSMON_TASK_NUM = 6
218# Support --sanity-check-build
219REEXEC_API_SANITY_CHECK_BUILD = 7
220# Support --previous-build-state
221REEXEC_API_PREVIOUS_BUILD_STATE = 8
222# Support --workspace
223REEXEC_API_WORKSPACE = 9
224# Support --master-buildbucket-id
225REEXEC_API_MASTER_BUILDBUCKET_ID = 10
226# Support --chromeos_goma_dir
227REEXEC_API_CHROMEOS_GOMA_DIR = 11
228# Support --chrome-preload-dir
229REEXEC_API_CHROME_PRELOAD_DIR = 12
230
231# We rely on the (waterfall, builder name, build number) to uniquely identify
232# a build. However, future migrations or state wipes of the buildbot master may
233# cause it to reset its build number counter. When that happens, this value
234# should be incremented, ensuring that (waterfall, builder name, build number,
235# buildbot generation) is a unique identifier of builds.
236BUILDBOT_GENERATION = 1
237
238ISOLATESERVER = 'https://isolateserver.appspot.com'
239
240GOOGLE_EMAIL = '@google.com'
241CHROMIUM_EMAIL = '@chromium.org'
242
243CORP_DOMAIN = 'corp.google.com'
244GOLO_DOMAIN = 'golo.chromium.org'
245CHROME_DOMAIN = 'chrome.' + CORP_DOMAIN
246CHROMEOS_BOT_INTERNAL = 'chromeos-bot.internal'
247
248GOB_HOST = '%s.googlesource.com'
249
250EXTERNAL_GOB_INSTANCE = 'chromium'
251EXTERNAL_GERRIT_INSTANCE = 'chromium-review'
252EXTERNAL_GOB_HOST = GOB_HOST % EXTERNAL_GOB_INSTANCE
253EXTERNAL_GERRIT_HOST = GOB_HOST % EXTERNAL_GERRIT_INSTANCE
254EXTERNAL_GOB_URL = 'https://%s' % EXTERNAL_GOB_HOST
255EXTERNAL_GERRIT_URL = 'https://%s' % EXTERNAL_GERRIT_HOST
256
257INTERNAL_GOB_INSTANCE = 'chrome-internal'
258INTERNAL_GERRIT_INSTANCE = 'chrome-internal-review'
259INTERNAL_GOB_HOST = GOB_HOST % INTERNAL_GOB_INSTANCE
260INTERNAL_GERRIT_HOST = GOB_HOST % INTERNAL_GERRIT_INSTANCE
261INTERNAL_GOB_URL = 'https://%s' % INTERNAL_GOB_HOST
262INTERNAL_GERRIT_URL = 'https://%s' % INTERNAL_GERRIT_HOST
263
264# Tests without 'cheets_CTS_', 'cheets_GTS.' prefix will not considered
265# as CTS/GTS test in chromite.lib.cts_helper
266DEFAULT_CTS_TEST_XML_MAP = {
267    'cheets_CTS_': 'test_result.xml',
268    'cheets_GTS.': 'test_result.xml',
269    'cheets_GTS_': 'test_result.xml',
270}
271# Google Storage bucket URI to store results in.
272DEFAULT_CTS_RESULTS_GSURI = 'gs://chromeos-cts-results/'
273DEFAULT_CTS_APFE_GSURI = 'gs://chromeos-cts-apfe/'
274
275ANDROID_CONTAINER_PACKAGE_KEYWORD = 'android-container'
276ANDROID_VM_PACKAGE_KEYWORD = 'android-vm'
277
278ANDROID_BUCKET_URL = 'gs://android-build-chromeos/builds'
279ANDROID_PI_BUILD_BRANCH = 'git_pi-arc'
280ANDROID_VMRVC_BUILD_BRANCH = 'git_rvc-arc-dev'
281ANDROID_VMMST_BUILD_BRANCH = 'git_master-arc-dev'
282
283ANDROID_PI_BUILD_TARGETS = {
284    # Roll XkbToKcmConverter with system image. It's a host executable and
285    # doesn't depend on the target as long as it's pi-arc branch. The converter
286    # is ARC specific and not a part of Android SDK. Having a custom target like
287    # SDK_TOOLS might be better in the long term, but let's use one from ARM or
288    # X86 target as there's no other similar executables right now.
289    # We put it in two buckets because we have separate ACLs for arm and x86.
290    # http://b/128405786
291    'APPS': ('linux-apps', 'org.chromium.arc.cachebuilder.jar'),
292    'ARM': ('linux-cheets_arm-user', r'(\.zip|/XkbToKcmConverter)$'),
293    'ARM64': ('linux-cheets_arm64-user', r'(\.zip|/XkbToKcmConverter)$'),
294    'X86': ('linux-cheets_x86-user', r'(\.zip|/XkbToKcmConverter)$'),
295    'X86_64': ('linux-cheets_x86_64-user', r'\.zip$'),
296    'ARM_USERDEBUG': ('linux-cheets_arm-userdebug', r'\.zip$'),
297    'ARM64_USERDEBUG': ('linux-cheets_arm64-userdebug', r'\.zip$'),
298    'X86_USERDEBUG': ('linux-cheets_x86-userdebug', r'\.zip$'),
299    'X86_64_USERDEBUG': ('linux-cheets_x86_64-userdebug', r'\.zip$'),
300    'SDK_GOOGLE_X86_USERDEBUG': ('linux-sdk_cheets_x86-userdebug', r'\.zip$'),
301    'SDK_GOOGLE_X86_64_USERDEBUG': ('linux-sdk_cheets_x86_64-userdebug',
302                                    r'\.zip$'),
303}
304ANDROID_VMMST_BUILD_TARGETS = {
305    # For XkbToKcmConverter, see the comment in ANDROID_PI_BUILD_TARGETS.
306    'X86_64_USERDEBUG': ('linux-bertha_x86_64-userdebug',
307                         r'(\.zip|/XkbToKcmConverter)$'),
308}
309ANDROID_VMRVC_BUILD_TARGETS = {
310    # For XkbToKcmConverter, see the comment in ANDROID_PI_BUILD_TARGETS.
311    'APPS': ('linux-apps', 'org.chromium.arc.cachebuilder.jar'),
312    'ARM64': ('linux-bertha_arm64-user', r'(\.zip|/XkbToKcmConverter)$'),
313    'X86_64': ('linux-bertha_x86_64-user', r'(\.zip|/XkbToKcmConverter)$'),
314    'ARM64_USERDEBUG': ('linux-bertha_arm64-userdebug',
315                        r'(\.zip|/XkbToKcmConverter)$'),
316    'X86_64_USERDEBUG': ('linux-bertha_x86_64-userdebug',
317                         r'(\.zip|/XkbToKcmConverter)$'),
318}
319
320# These refer to *_TARGET variables in Android ebuild files, used when
321# parsing ebuilds to determine the corresponding Android branch.
322# NOTE: We may use `|` operator to union dict keys after we completely go
323# Python 3.
324ANDROID_ALL_BUILD_TARGETS = frozenset(
325    x + '_TARGET' for x in itertools.chain(
326        ANDROID_PI_BUILD_TARGETS,
327        ANDROID_VMMST_BUILD_TARGETS,
328        ANDROID_VMRVC_BUILD_TARGETS,
329    )
330)
331
332ARC_BUCKET_URL = 'gs://chromeos-arc-images/builds'
333ARC_BUCKET_ACLS = {
334    'APPS': 'googlestorage_acl_public.txt',
335    'ARM': 'googlestorage_acl_arm.txt',
336    'ARM64': 'googlestorage_acl_arm.txt',
337    'X86': 'googlestorage_acl_x86.txt',
338    'X86_64': 'googlestorage_acl_x86.txt',
339    'ARM_USERDEBUG': 'googlestorage_acl_arm.txt',
340    'ARM64_USERDEBUG': 'googlestorage_acl_arm.txt',
341    'X86_USERDEBUG': 'googlestorage_acl_x86.txt',
342    'X86_64_USERDEBUG': 'googlestorage_acl_x86.txt',
343    'SDK_GOOGLE_X86_USERDEBUG': 'googlestorage_acl_x86.txt',
344    'SDK_GOOGLE_X86_64_USERDEBUG': 'googlestorage_acl_x86.txt',
345}
346ANDROID_SYMBOLS_URL_TEMPLATE = (
347    ARC_BUCKET_URL +
348    '/%(branch)s-linux-%(target)s_%(arch)s-%(variant)s/%(version)s'
349    '/%(target)s_%(arch)s%(suffix)s-symbols-%(version)s.zip')
350ANDROID_SYMBOLS_FILE = 'android-symbols.zip'
351# x86-user, x86-userdebug and x86-eng builders create build artifacts with the
352# same name, e.g. cheets_x86-target_files-${VERSION}.zip. ChromeOS builders
353# that need to select x86-user or x86-userdebug artifacts at emerge time need
354# the artifacts to have different filenames to avoid checksum failures. These
355# targets will have their artifacts renamed when the PFQ copies them from the
356# the Android bucket to the ARC++ bucket (b/33072485).
357ARC_BUILDS_NEED_ARTIFACTS_RENAMED = {
358    'ARM_USERDEBUG',
359    'ARM64_USERDEBUG',
360    'X86_USERDEBUG',
361    'X86_64_USERDEBUG',
362    'SDK_GOOGLE_X86_USERDEBUG',
363    'SDK_GOOGLE_X86_64_USERDEBUG',
364}
365# All builds will have the same name without target prefix.
366# Emerge checksum failures will be workarounded by ebuild rename symbol (->).
367ARC_ARTIFACTS_RENAME_NOT_NEEDED = [
368    'push_to_device.zip',
369    'sepolicy.zip',
370    'XkbToKcmConverter',
371]
372
373GOB_COOKIE_PATH = os.path.expanduser('~/.git-credential-cache/cookie')
374GITCOOKIES_PATH = os.path.expanduser('~/.gitcookies')
375
376# Timestamps in the JSON from GoB's web interface is of the form 'Tue
377# Dec 02 17:48:06 2014' and is assumed to be in UTC.
378GOB_COMMIT_TIME_FORMAT = '%a %b %d %H:%M:%S %Y'
379
380CHROMITE_PROJECT = 'chromiumos/chromite'
381CHROMITE_URL = '%s/%s' % (EXTERNAL_GOB_URL, CHROMITE_PROJECT)
382CHROMIUM_SRC_PROJECT = 'chromium/src'
383CHROMIUM_GOB_URL = '%s/%s.git' % (EXTERNAL_GOB_URL, CHROMIUM_SRC_PROJECT)
384CHROME_INTERNAL_PROJECT = 'chrome/src-internal'
385CHROME_INTERNAL_GOB_URL = '%s/%s.git' % (
386    INTERNAL_GOB_URL, CHROME_INTERNAL_PROJECT)
387
388DEFAULT_MANIFEST = 'default.xml'
389OFFICIAL_MANIFEST = 'official.xml'
390LKGM_MANIFEST = 'LKGM/lkgm.xml'
391
392SHARED_CACHE_ENVVAR = 'CROS_CACHEDIR'
393PARALLEL_EMERGE_STATUS_FILE_ENVVAR = 'PARALLEL_EMERGE_STATUS_FILE'
394
395# These projects can be responsible for infra failures.
396INFRA_PROJECTS = (CHROMITE_PROJECT,)
397
398# The manifest contains extra attributes in the 'project' nodes to determine our
399# branching strategy for the project.
400#   create: Create a new branch on the project repo for the new CrOS branch.
401#           This is the default.
402#   pin: On the CrOS branch, pin the project to the current revision.
403#   tot: On the CrOS branch, the project still tracks ToT.
404MANIFEST_ATTR_BRANCHING = 'branch-mode'
405MANIFEST_ATTR_BRANCHING_CREATE = 'create'
406MANIFEST_ATTR_BRANCHING_PIN = 'pin'
407MANIFEST_ATTR_BRANCHING_TOT = 'tot'
408MANIFEST_ATTR_BRANCHING_ALL = (
409    MANIFEST_ATTR_BRANCHING_CREATE,
410    MANIFEST_ATTR_BRANCHING_PIN,
411    MANIFEST_ATTR_BRANCHING_TOT,
412)
413
414STREAK_COUNTERS = 'streak_counters'
415
416PATCH_BRANCH = 'patch_branch'
417STABLE_EBUILD_BRANCH = 'stabilizing_branch'
418MERGE_BRANCH = 'merge_branch'
419
420# These branches are deleted at the beginning of every buildbot run.
421CREATED_BRANCHES = [
422    PATCH_BRANCH,
423    STABLE_EBUILD_BRANCH,
424    MERGE_BRANCH
425]
426
427# Default OS target packages.
428TARGET_OS_PKG = 'virtual/target-os'
429TARGET_OS_DEV_PKG = 'virtual/target-os-dev'
430TARGET_OS_TEST_PKG = 'virtual/target-os-test'
431TARGET_OS_FACTORY_PKG = 'virtual/target-os-factory'
432
433# Constants for uprevving Chrome
434
435CHROMEOS_BASE = 'chromeos-base'
436
437# Portage category and package name for Chrome.
438CHROME_CN = CHROMEOS_BASE
439CHROME_PN = 'chromeos-chrome'
440CHROME_CP = '%s/%s' % (CHROME_CN, CHROME_PN)
441
442# Other packages to uprev while uprevving Chrome.
443OTHER_CHROME_PACKAGES = ['chromeos-base/chromium-source',
444                         'chromeos-base/chrome-icu']
445
446# Chrome use flags
447USE_CHROME_INTERNAL = 'chrome_internal'
448USE_AFDO_USE = 'afdo_use'
449
450
451# Builds and validates _alpha ebuilds.  These builds sync to the latest
452# revsion of the Chromium src tree and build with that checkout.
453CHROME_REV_TOT = 'tot'
454
455# Builds and validates chrome at a given revision through cbuildbot
456# --chrome_version
457CHROME_REV_SPEC = 'spec'
458
459# Builds and validates the latest Chromium release as defined by
460# ~/trunk/releases in the Chrome src tree.  These ebuilds are suffixed with rc.
461CHROME_REV_LATEST = 'latest_release'
462
463# Builds and validates the latest Chromium release for a specific Chromium
464# branch that we want to watch.  These ebuilds are suffixed with rc.
465CHROME_REV_STICKY = 'stable_release'
466
467# Builds and validates Chromium for a pre-populated directory.
468# Also uses _alpha, since portage doesn't have anything lower.
469CHROME_REV_LOCAL = 'local'
470VALID_CHROME_REVISIONS = [CHROME_REV_TOT, CHROME_REV_LATEST,
471                          CHROME_REV_STICKY, CHROME_REV_LOCAL, CHROME_REV_SPEC]
472
473
474# Constants for uprevving Android.
475
476# Portage package name for Android container.
477ANDROID_PACKAGE_NAME = 'android-container'
478
479# Builds and validates the latest Android release.
480ANDROID_REV_LATEST = 'latest_release'
481VALID_ANDROID_REVISIONS = [ANDROID_REV_LATEST]
482
483# Build types supported.
484
485# TODO(sosa): Deprecate PFQ type.
486# Incremental builds that are built using binary packages when available.
487# These builds have less validation than other build types.
488INCREMENTAL_TYPE = 'binary'
489
490# These builds serve as PFQ builders.  This is being deprecated.
491PFQ_TYPE = 'pfq'
492
493# Android PFQ type.  Builds and validates new versions of Android.
494ANDROID_PFQ_TYPE = 'android'
495
496# Builds from source and non-incremental.  This builds fully wipe their
497# chroot before the start of every build and no not use a BINHOST.
498FULL_TYPE = 'full'
499
500# Full but with versioned logic.
501CANARY_TYPE = 'canary'
502
503# Generate payloads for an already built build/version.
504PAYLOADS_TYPE = 'payloads'
505
506# Similar behavior to canary, but used to validate toolchain changes.
507TOOLCHAIN_TYPE = 'toolchain'
508
509# Generic type of tryjob only build configs.
510TRYJOB_TYPE = 'tryjob'
511
512# Special build type for Chroot builders.  These builds focus on building
513# toolchains and validate that they work.
514CHROOT_BUILDER_TYPE = 'chroot'
515CHROOT_BUILDER_BOARD = 'amd64-host'
516
517# Use for builds that don't requite a type.
518GENERIC_TYPE = 'generic'
519
520VALID_BUILD_TYPES = (
521    INCREMENTAL_TYPE,
522    FULL_TYPE,
523    CANARY_TYPE,
524    CHROOT_BUILDER_TYPE,
525    CHROOT_BUILDER_BOARD,
526    ANDROID_PFQ_TYPE,
527    PFQ_TYPE,
528    PAYLOADS_TYPE,
529    TOOLCHAIN_TYPE,
530    TRYJOB_TYPE,
531    GENERIC_TYPE,
532)
533
534HWTEST_TRYBOT_NUM = 3
535HWTEST_QUOTA_POOL = 'quota'
536
537HWTEST_QUOTA_ACCOUNT_BVT = 'legacypool-bvt'
538HWTEST_QUOTA_ACCOUNT_BVT_SYNC = 'bvt-sync'
539HWTEST_QUOTA_ACCOUNT_PFQ = 'pfq'
540HWTEST_QUOTA_ACCOUNT_SUITES = 'legacypool-suites'
541HWTEST_QUOTA_ACCOUNT_TOOLCHAIN = 'toolchain'
542
543# How many total test retries should be done for a suite.
544HWTEST_MAX_RETRIES = 5
545
546# Defines for the various hardware test suites:
547#   BVT:  Basic blocking suite to be run against any build that
548#       requires a HWTest phase.
549#   COMMIT:  Suite of basic tests required for commits to the source
550#       tree.  Runs as a blocking suite on the CQ and PFQ; runs as
551#       a non-blocking suite on canaries.
552#   CANARY:  Non-blocking suite run only against the canaries.
553#   AFDO:  Non-blocking suite run only AFDO builders.
554#   MOBLAB: Blocking Suite run only on *_moblab builders.
555#   INSTALLER: Blocking suite run against all canaries; tests basic installer
556#              functionality.
557HWTEST_ARC_COMMIT_SUITE = 'bvt-arc'
558HWTEST_BVT_SUITE = 'bvt-inline'
559HWTEST_COMMIT_SUITE = 'bvt-cq'
560HWTEST_CANARY_SUITE = 'bvt-perbuild'
561HWTEST_INSTALLER_SUITE = 'bvt-installer'
562# Runs all non-informational Tast tests (exercising any of OS, Chrome, and ARC).
563HWTEST_TAST_CQ_SUITE = 'bvt-tast-cq'
564# Runs non-informational Tast tests exercising either Chrome or ARC.
565HWTEST_TAST_CHROME_PFQ_SUITE = 'bvt-tast-chrome-pfq'
566# Runs non-informational Tast tests exercising ARC.
567HWTEST_TAST_ANDROID_PFQ_SUITE = 'bvt-tast-android-pfq'
568# Runs all Tast informational tests.
569HWTEST_TAST_INFORMATIONAL_SUITE = 'bvt-tast-informational'
570HWTEST_AFDO_SUITE = 'AFDO_record'
571HWTEST_JETSTREAM_COMMIT_SUITE = 'jetstream_cq'
572HWTEST_MOBLAB_SUITE = 'moblab'
573HWTEST_MOBLAB_QUICK_SUITE = 'moblab_quick'
574HWTEST_SANITY_SUITE = 'sanity'
575HWTEST_TOOLCHAIN_SUITE = 'toolchain-tests'
576# Non-blocking informational hardware tests for Chrome, run throughout the
577# day on tip-of-trunk Chrome rather than on the daily Chrome branch.
578HWTEST_CHROME_INFORMATIONAL = 'chrome-informational'
579
580# Additional timeout to wait for autotest to abort a suite if the test takes
581# too long to run. This is meant to be overly conservative as a timeout may
582# indicate that autotest is at capacity.
583HWTEST_TIMEOUT_EXTENSION = 10 * 60
584
585HWTEST_WEEKLY_PRIORITY = 'Weekly'
586HWTEST_CTS_PRIORITY = 'CTS'
587HWTEST_GTS_PRIORITY = HWTEST_CTS_PRIORITY
588HWTEST_DAILY_PRIORITY = 'Daily'
589HWTEST_DEFAULT_PRIORITY = 'DEFAULT'
590HWTEST_CQ_PRIORITY = 'CQ'
591HWTEST_BUILD_PRIORITY = 'Build'
592HWTEST_PFQ_PRIORITY = 'PFQ'
593HWTEST_POST_BUILD_PRIORITY = 'PostBuild'
594
595# Ordered by priority (first item being lowest).
596HWTEST_VALID_PRIORITIES = [HWTEST_WEEKLY_PRIORITY,
597                           HWTEST_CTS_PRIORITY,
598                           HWTEST_DAILY_PRIORITY,
599                           HWTEST_POST_BUILD_PRIORITY,
600                           HWTEST_DEFAULT_PRIORITY,
601                           HWTEST_BUILD_PRIORITY,
602                           HWTEST_PFQ_PRIORITY,
603                           HWTEST_CQ_PRIORITY]
604
605# Creates a mapping of priorities to make easy comparsions.
606# Use the same priorities mapping as autotest/client/common_lib/priorities.py
607HWTEST_PRIORITIES_MAP = {
608    HWTEST_WEEKLY_PRIORITY: 10,
609    HWTEST_CTS_PRIORITY: 11,
610    HWTEST_DAILY_PRIORITY: 20,
611    HWTEST_POST_BUILD_PRIORITY: 30,
612    HWTEST_DEFAULT_PRIORITY: 40,
613    HWTEST_BUILD_PRIORITY: 50,
614    HWTEST_PFQ_PRIORITY: 60,
615    HWTEST_CQ_PRIORITY: 70}
616
617# Creates a mapping of priorities for skylab hwtest tasks. In swarming,
618# lower number means high priorities. Priority lower than 48 will be special
619# tasks. The upper bound of priority is 255.
620# Use the same priorities mapping as autotest/venv/skylab_suite/swarming_lib.py
621SKYLAB_HWTEST_PRIORITIES_MAP = {
622    HWTEST_WEEKLY_PRIORITY: 230,
623    HWTEST_CTS_PRIORITY: 215,
624    HWTEST_DAILY_PRIORITY: 200,
625    HWTEST_POST_BUILD_PRIORITY: 170,
626    HWTEST_DEFAULT_PRIORITY: 140,
627    HWTEST_BUILD_PRIORITY: 110,
628    HWTEST_PFQ_PRIORITY: 80,
629    HWTEST_CQ_PRIORITY: 50,
630}
631
632# The environment for executing tests.
633ENV_SKYLAB = 'skylab'
634ENV_AUTOTEST = 'autotest'
635
636# The cipd package for skylab tool
637CIPD_SKYLAB_PACKAGE = 'chromiumos/infra/skylab/linux-amd64'
638# crbug.com/1108489: The skylab tool CIPD package is pinned to a specific
639# version to avoid uncontrolled tool release and so that the tool is effectively
640# branched with cbuildbot.
641CIPD_SKYLAB_INSTANCE_ID = 'LU2Xmdk1oXyZPuiEfzDQhUWFMXY3jYQNPOzHRkRkZBEC'
642
643# HWTest result statuses
644HWTEST_STATUS_PASS = 'pass'
645HWTEST_STATUS_FAIL = 'fail'
646HWTEST_STATUS_ABORT = 'abort'
647HWTEST_STATUS_OTHER = 'other'
648HWTEST_STATUES_NOT_PASSED = frozenset([HWTEST_STATUS_FAIL,
649                                       HWTEST_STATUS_ABORT,
650                                       HWTEST_STATUS_OTHER])
651
652# Build messages
653MESSAGE_TYPE_IGNORED_REASON = 'ignored_reason'
654MESSAGE_TYPE_ANNOTATIONS_FINALIZED = 'annotations_finalized'
655# MESSSGE_TYPE_IGNORED_REASON messages store the affected build as
656# the CIDB column message_value.
657MESSAGE_SUBTYPE_SELF_DESTRUCTION = 'self_destruction'
658
659# Define HWTEST job_keyvals
660JOB_KEYVAL_DATASTORE_PARENT_KEY = 'datastore_parent_key'
661JOB_KEYVAL_CIDB_BUILD_ID = 'cidb_build_id'
662JOB_KEYVAL_CIDB_BUILD_STAGE_ID = 'cidb_build_stage_id'
663JOB_KEYVAL_BUILD_CONFIG = 'build_config'
664JOB_KEYVAL_MASTER_BUILD_CONFIG = 'master_build_config'
665JOB_KEYVAL_BRANCH = 'branch'
666
667
668# How many total test retries should be done for a suite.
669VM_TEST_MAX_RETRIES = 5
670# Defines VM Test types.
671SIMPLE_AU_TEST_TYPE = 'pfq_suite'
672VM_SUITE_TEST_TYPE = 'vm_suite'
673GCE_SUITE_TEST_TYPE = 'gce_suite'
674CROS_VM_TEST_TYPE = 'cros_vm_test'
675DEV_MODE_TEST_TYPE = 'dev_mode_test'
676VALID_VM_TEST_TYPES = [
677    SIMPLE_AU_TEST_TYPE,
678    VM_SUITE_TEST_TYPE,
679    GCE_SUITE_TEST_TYPE,
680    CROS_VM_TEST_TYPE,
681    DEV_MODE_TEST_TYPE
682]
683VALID_GCE_TEST_SUITES = ['gce-smoke', 'gce-sanity']
684# MoblabVM tests are suites of tests used to validate a moblab image via
685# VMTests.
686MOBLAB_VM_SMOKE_TEST_TYPE = 'moblab_smoke_test'
687
688CHROMIUMOS_OVERLAY_DIR = 'src/third_party/chromiumos-overlay'
689PORTAGE_STABLE_OVERLAY_DIR = 'src/third_party/portage-stable'
690ECLASS_OVERLAY_DIR = 'src/third_party/eclass-overlay'
691CHROMEOS_PARTNER_OVERLAY_DIR = 'src/private-overlays/chromeos-partner-overlay/'
692PUBLIC_BINHOST_CONF_DIR = os.path.join(CHROMIUMOS_OVERLAY_DIR,
693                                       'chromeos/binhost')
694PRIVATE_BINHOST_CONF_DIR = os.path.join(CHROMEOS_PARTNER_OVERLAY_DIR,
695                                        'chromeos/binhost')
696
697VERSION_FILE = os.path.join(CHROMIUMOS_OVERLAY_DIR,
698                            'chromeos/config/chromeos_version.sh')
699SDK_VERSION_FILE = os.path.join(PUBLIC_BINHOST_CONF_DIR,
700                                'host/sdk_version.conf')
701SDK_GS_BUCKET = 'chromiumos-sdk'
702
703PUBLIC = 'public'
704PRIVATE = 'private'
705
706BOTH_OVERLAYS = 'both'
707PUBLIC_OVERLAYS = PUBLIC
708PRIVATE_OVERLAYS = PRIVATE
709VALID_OVERLAYS = [BOTH_OVERLAYS, PUBLIC_OVERLAYS, PRIVATE_OVERLAYS, None]
710
711# Common default logging settings for use with the logging module.
712LOGGER_FMT = '%(asctime)s: %(levelname)s: %(message)s'
713LOGGER_DATE_FMT = '%H:%M:%S'
714
715# Used by remote patch serialization/deserialzation.
716INTERNAL_PATCH_TAG = 'i'
717EXTERNAL_PATCH_TAG = 'e'
718PATCH_TAGS = (INTERNAL_PATCH_TAG, EXTERNAL_PATCH_TAG)
719
720GERRIT_ON_BORG_LABELS = {
721    'Code-Review': 'CRVW',
722    'Commit-Queue': 'COMR',
723    'Verified': 'VRIF',
724}
725
726# Environment variables that should be exposed to all children processes
727# invoked via cros_build_lib.run.
728ENV_PASSTHRU = ('CROS_SUDO_KEEP_ALIVE', SHARED_CACHE_ENVVAR,
729                PARALLEL_EMERGE_STATUS_FILE_ENVVAR)
730
731# List of variables to proxy into the chroot from the host, and to
732# have sudo export if existent. Anytime this list is modified, a new
733# chroot_version_hooks.d upgrade script that symlinks to 153_rewrite_sudoers.d
734# should be created.
735CHROOT_ENVIRONMENT_WHITELIST = (
736    'CHROMEOS_OFFICIAL',
737    'CHROMEOS_VERSION_AUSERVER',
738    'CHROMEOS_VERSION_DEVSERVER',
739    'CHROMEOS_VERSION_TRACK',
740    'GCC_GITHASH',
741    'GIT_AUTHOR_EMAIL',
742    'GIT_AUTHOR_NAME',
743    'GIT_COMMITTER_EMAIL',
744    'GIT_COMMITTER_NAME',
745    'GIT_PROXY_COMMAND',
746    'GIT_SSH',
747    'RSYNC_PROXY',
748    'SSH_AGENT_PID',
749    'SSH_AUTH_SOCK',
750    'TMUX',
751    'USE',
752    'all_proxy',
753    'ftp_proxy',
754    'http_proxy',
755    'https_proxy',
756    'no_proxy',
757)
758
759# Paths for Chrome LKGM which are relative to the Chromium base url.
760CHROME_LKGM_FILE = 'CHROMEOS_LKGM'
761PATH_TO_CHROME_LKGM = 'chromeos/%s' % CHROME_LKGM_FILE
762# Path for the Chrome LKGM's closest OWNERS file.
763PATH_TO_CHROME_CHROMEOS_OWNERS = 'chromeos/OWNERS'
764
765# Cache constants.
766COMMON_CACHE = 'common'
767
768def _SlashToUnderscore(string):
769    """Artifact constants."""
770    return string.replace('/', '_')
771
772
773def ImageBinToGceTar(image_bin):
774    """GCE tar ball constants."""
775    assert image_bin.endswith('.bin'), (
776            'Filename %s does not end with ".bin"' % image_bin)
777    return '%s_gce.tar.gz' % os.path.splitext(image_bin)[0]
778
779
780RELEASE_BUCKET = 'gs://chromeos-releases'
781TRASH_BUCKET = 'gs://chromeos-throw-away-bucket'
782CHROME_SYSROOT_TAR = 'sysroot_%s.tar.xz' % _SlashToUnderscore(CHROME_CP)
783CHROME_ENV_TAR = 'environment_%s.tar.xz' % _SlashToUnderscore(CHROME_CP)
784CHROME_ENV_FILE = 'environment'
785BASE_IMAGE_NAME = 'chromiumos_base_image'
786BASE_IMAGE_TAR = '%s.tar.xz' % BASE_IMAGE_NAME
787BASE_IMAGE_BIN = '%s.bin' % BASE_IMAGE_NAME
788BASE_IMAGE_GCE_TAR = ImageBinToGceTar(BASE_IMAGE_BIN)
789IMAGE_SCRIPTS_NAME = 'image_scripts'
790IMAGE_SCRIPTS_TAR = '%s.tar.xz' % IMAGE_SCRIPTS_NAME
791TARGET_SYSROOT_TAR = 'sysroot_%s.tar.xz' % _SlashToUnderscore(TARGET_OS_PKG)
792VM_IMAGE_NAME = 'chromiumos_qemu_image'
793VM_IMAGE_BIN = '%s.bin' % VM_IMAGE_NAME
794VM_IMAGE_TAR = '%s.tar.xz' % VM_IMAGE_NAME
795VM_DISK_PREFIX = 'chromiumos_qemu_disk.bin'
796VM_MEM_PREFIX = 'chromiumos_qemu_mem.bin'
797VM_NUM_RETRIES = 0
798# Disabling Tast VM retries because of https://crbug.com/1098346.
799TAST_VM_NUM_RETRIES = 0
800TAST_VM_TEST_RESULTS = 'tast_vm_test_results_%(attempt)s'
801BASE_GUEST_VM_DIR = 'guest-vm-base'
802TEST_GUEST_VM_DIR = 'guest-vm-test'
803BASE_GUEST_VM_TAR = '%s.tar.xz' % BASE_GUEST_VM_DIR
804TEST_GUEST_VM_TAR = '%s.tar.xz' % TEST_GUEST_VM_DIR
805
806TEST_IMAGE_NAME = 'chromiumos_test_image'
807TEST_IMAGE_TAR = '%s.tar.xz' % TEST_IMAGE_NAME
808TEST_IMAGE_BIN = '%s.bin' % TEST_IMAGE_NAME
809TEST_IMAGE_GCE_TAR = ImageBinToGceTar(TEST_IMAGE_BIN)
810TEST_KEY_PRIVATE = 'id_rsa'
811TEST_KEY_PUBLIC = 'id_rsa.pub'
812
813DEV_IMAGE_NAME = 'chromiumos_image'
814DEV_IMAGE_BIN = '%s.bin' % DEV_IMAGE_NAME
815
816RECOVERY_IMAGE_NAME = 'recovery_image'
817RECOVERY_IMAGE_BIN = '%s.bin' % RECOVERY_IMAGE_NAME
818RECOVERY_IMAGE_TAR = '%s.tar.xz' % RECOVERY_IMAGE_NAME
819
820# Image type constants.
821IMAGE_TYPE_BASE = 'base'
822IMAGE_TYPE_DEV = 'dev'
823IMAGE_TYPE_TEST = 'test'
824IMAGE_TYPE_RECOVERY = 'recovery'
825IMAGE_TYPE_FACTORY = 'factory'
826IMAGE_TYPE_FIRMWARE = 'firmware'
827# USB PD accessory microcontroller firmware (e.g. power brick, display dongle).
828IMAGE_TYPE_ACCESSORY_USBPD = 'accessory_usbpd'
829# Standalone accessory microcontroller firmware (e.g. wireless keyboard).
830IMAGE_TYPE_ACCESSORY_RWSIG = 'accessory_rwsig'
831# Cr50 Firmware.
832IMAGE_TYPE_CR50_FIRMWARE = 'cr50_firmware'
833
834IMAGE_TYPE_TO_NAME = {
835    IMAGE_TYPE_BASE: BASE_IMAGE_BIN,
836    IMAGE_TYPE_DEV: DEV_IMAGE_BIN,
837    IMAGE_TYPE_RECOVERY: RECOVERY_IMAGE_BIN,
838    IMAGE_TYPE_TEST: TEST_IMAGE_BIN,
839}
840IMAGE_NAME_TO_TYPE = dict((v, k) for k, v in IMAGE_TYPE_TO_NAME.items())
841
842METADATA_JSON = 'metadata.json'
843PARTIAL_METADATA_JSON = 'partial-metadata.json'
844METADATA_TAGS = 'tags'
845DELTA_SYSROOT_TAR = 'delta_sysroot.tar.xz'
846DELTA_SYSROOT_BATCH = 'batch'
847
848FIRMWARE_ARCHIVE_NAME = 'firmware_from_source.tar.bz2'
849
850# Global configuration constants.
851CHROMITE_CONFIG_DIR = os.path.expanduser('~/.chromite')
852CHROME_SDK_BASHRC = os.path.join(CHROMITE_CONFIG_DIR, 'chrome_sdk.bashrc')
853SYNC_RETRIES = 4
854SLEEP_TIMEOUT = 30
855
856# Lab status url.
857LAB_STATUS_URL = 'http://chromiumos-lab.appspot.com/current?format=json'
858
859GOLO_SMTP_SERVER = 'mail.golo.chromium.org'
860
861CHROME_GARDENER = 'chrome'
862# Email alias to add as reviewer in Gerrit, which GWSQ will then automatically
863# assign to the current gardener.
864CHROME_GARDENER_REVIEW_EMAIL = 'chrome-os-gardeners@google.com'
865
866# Useful config targets.
867CANARY_MASTER = 'master-release'
868PFQ_MASTER = 'master-chromium-pfq'
869VMMST_ANDROID_PFQ_MASTER = 'master-vmmst-android-pfq'
870PI_ANDROID_PFQ_MASTER = 'master-pi-android-pfq'
871VMRVC_ANDROID_PFQ_MASTER = 'master-vmrvc-android-pfq'
872TOOLCHAIN_MASTTER = 'master-toolchain'
873
874
875# Email validation regex. Not quite fully compliant with RFC 2822, but good
876# approximation.
877EMAIL_REGEX = r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}'
878
879# Blacklist of files not allowed to be uploaded into the Partner Project Google
880# Storage Buckets:
881# debug.tgz contains debug symbols.
882# manifest.xml exposes all of our repo names.
883# vm_test_results can contain symbolicated crash dumps.
884EXTRA_BUCKETS_FILES_BLACKLIST = [
885    'debug.tgz',
886    'manifest.xml',
887    'vm_test_results_*'
888]
889
890# AFDO common constants.
891# How long does the AFDO_record autotest have to generate the AFDO perf data.
892AFDO_GENERATE_TIMEOUT = 120 * 60
893
894# Gmail Credentials.
895GMAIL_TOKEN_CACHE_FILE = os.path.expanduser('~/.gmail_credentials')
896GMAIL_TOKEN_JSON_FILE = '/creds/refresh_tokens/chromeos_gmail_alerts'
897
898# Maximum number of boards per release group builder. This should be
899# chosen/adjusted based on expected release build times such that successive
900# builds don't overlap and create a backlog.
901MAX_RELEASE_GROUP_BOARDS = 4
902
903CHROMEOS_SERVICE_ACCOUNT = os.path.join('/', 'creds', 'service_accounts',
904                                        'service-account-chromeos.json')
905
906# Buildbucket buckets
907CHROMEOS_RELEASE_BUILDBUCKET_BUCKET = 'master.chromeos_release'
908CHROMEOS_BUILDBUCKET_BUCKET = 'master.chromeos'
909INTERNAL_SWARMING_BUILDBUCKET_BUCKET = 'luci.chromeos.general'
910
911ACTIVE_BUCKETS = [
912    CHROMEOS_RELEASE_BUILDBUCKET_BUCKET,
913    CHROMEOS_BUILDBUCKET_BUCKET,
914    INTERNAL_SWARMING_BUILDBUCKET_BUCKET,
915]
916
917# Build retry limit on buildbucket
918#
919# 2020-05-13 by engeg@: This is rarely effective, causes confusion,
920# higher bot utilization, and if the initial try was past uploading artifacts
921# then the retry is destined to fail with a difficult to parse error.
922# 2020-05-19 by seanabraham@: Leave this at zero. These retries can break
923# Chrome-wide profiling. http://b/156994019
924BUILDBUCKET_BUILD_RETRY_LIMIT = 0  # Do not change. Read the above.
925
926# TODO(nxia): consolidate all run.metadata key constants,
927# add a unit test to avoid duplicated keys in run_metadata
928
929# Builder_run metadata keys
930METADATA_SCHEDULED_IMPORTANT_SLAVES = 'scheduled_important_slaves'
931METADATA_SCHEDULED_EXPERIMENTAL_SLAVES = 'scheduled_experimental_slaves'
932METADATA_UNSCHEDULED_SLAVES = 'unscheduled_slaves'
933# List of builders marked as experimental through the tree status, not all the
934# experimental builders for a run.
935METADATA_EXPERIMENTAL_BUILDERS = 'experimental_builders'
936
937# Metadata key to indicate whether a build is self-destructed.
938SELF_DESTRUCTED_BUILD = 'self_destructed_build'
939
940# Metadata key to indicate whether a build is self-destructed with success.
941SELF_DESTRUCTED_WITH_SUCCESS_BUILD = 'self_destructed_with_success_build'
942
943# Chroot snapshot names
944CHROOT_SNAPSHOT_CLEAN = 'clean-chroot'
945
946# Partition labels.
947PART_STATE = 'STATE'
948PART_ROOT_A = 'ROOT-A'
949PART_ROOT_B = 'ROOT-B'
950PART_KERN_A = 'KERN-A'
951PART_KERN_B = 'KERN-B'
952
953# Quick provision payloads. These file names should never be changed, otherwise
954# very bad things can happen :). The reason is we have already uploaded these
955# files with these names for all boards. So if the name changes, all scripts
956# that have been using this need to handle both cases to be backward compatible.
957QUICK_PROVISION_PAYLOAD_KERNEL = 'full_dev_part_KERN.bin.gz'
958QUICK_PROVISION_PAYLOAD_ROOTFS = 'full_dev_part_ROOT.bin.gz'
959
960# Mock build and stage IDs.
961MOCK_STAGE_ID = 313377
962MOCK_BUILD_ID = 31337
963
964# Topology dictionary copied from CIDB.
965TOPOLOGY_DICT = {
966    '/buildbucket/host':
967        'cr-buildbucket.appspot.com',
968    '/chrome_swarming_proxy/host':
969        'chromeos-swarming.appspot.com',
970    '/datastore/creds_file': ('/creds/service_accounts/service-account-chromeos'
971                              '-datastore-writer-prod.json'),
972    '/sheriffomatic/host':
973        'sheriff-o-matic.appspot.com',
974    '/statsd/es_host':
975        '104.154.79.237',
976    '/statsd/host':
977        '104.154.79.237',
978}
979
980# Percentage of child builders that need to complete to update LKGM
981LKGM_THRESHOLD = 80
982