Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: scripts/slave/recipe_modules/chromite/config.py

Issue 2365023002: Enable --git-cache-dir option in chromite/cbuildbot. (Closed)
Patch Set: Better min branch. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import os 5 import os
6 import types 6 import re
7 7
8 from recipe_engine.config import config_item_context, ConfigGroup 8 from recipe_engine.config import config_item_context, ConfigGroup
9 from recipe_engine.config import Dict, Single, Set 9 from recipe_engine.config import Dict, Single, Set
10 10
11 11
12 # Regular expression to match branch versions.
13 #
14 # Examples:
15 # - release-R54-8743.B
16 # - stabilize-8743.B
17 # - factory-gale-8743.19.B
18 # - stabilize-8743.25.B
19 _VERSION_RE = re.compile(r'^.*-(\d+)\.(\d+\.)?B$')
20
21
12 def BaseConfig(CBB_CONFIG=None, CBB_BRANCH=None, CBB_BUILD_NUMBER=None, 22 def BaseConfig(CBB_CONFIG=None, CBB_BRANCH=None, CBB_BUILD_NUMBER=None,
13 CBB_DEBUG=False, CBB_CLOBBER=False, CBB_BUILDBUCKET_ID=None, 23 CBB_DEBUG=False, CBB_CLOBBER=False, CBB_BUILDBUCKET_ID=None,
14 CBB_MASTER_BUILD_ID=None, **_kwargs): 24 CBB_MASTER_BUILD_ID=None, **_kwargs):
15 return ConfigGroup( 25 return ConfigGroup(
16 # Base mapping of repository key to repository name. 26 # Base mapping of repository key to repository name.
17 repositories = Dict(value_type=Set(basestring)), 27 repositories = Dict(value_type=Set(basestring)),
18 28
19 # Checkout Chromite at this branch. "origin/" will be prepended. 29 # Checkout Chromite at this branch. "origin/" will be prepended.
20 chromite_branch = Single(basestring, empty_val=CBB_BRANCH or 'master'), 30 chromite_branch = Single(basestring, empty_val=CBB_BRANCH or 'master'),
21 31
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 config_repo = Single(basestring), 78 config_repo = Single(basestring),
69 79
70 # This disables Chromite bootstrapping by omitting the explicit "--branch" 80 # This disables Chromite bootstrapping by omitting the explicit "--branch"
71 # argument. 81 # argument.
72 disable_bootstrap = Single(bool), 82 disable_bootstrap = Single(bool),
73 83
74 # Whether this Chromite version supports warm cache. 84 # Whether this Chromite version supports warm cache.
75 # https://chromium-review.googlesource.com/#/c/348011 85 # https://chromium-review.googlesource.com/#/c/348011
76 supports_repo_cache = Single(bool), 86 supports_repo_cache = Single(bool),
77 87
88 # If set, supply the "--git-cache-dir" option with this value.
89 git_cache_dir = Single(basestring),
90
78 # If supplied, forward to cbuildbot as '--buildbucket-id' 91 # If supplied, forward to cbuildbot as '--buildbucket-id'
79 buildbucket_id = Single(basestring, empty_val=CBB_BUILDBUCKET_ID) 92 buildbucket_id = Single(basestring, empty_val=CBB_BUILDBUCKET_ID)
80 ), 93 ),
81 94
82 # A list of branches whose Chromite version is "old". Old Chromite 95 # A list of branches whose Chromite version is "old". Old Chromite
83 # buildbot commands reside in the "buildbot" subdirectory of the Chromite 96 # buildbot commands reside in the "buildbot" subdirectory of the Chromite
84 # repository instead of the "bin". 97 # repository instead of the "bin".
85 old_chromite_branches = Set(basestring), 98 old_chromite_branches = Set(basestring),
86 99
87 # A list of branches whose builders should not use a shared buildroot. 100 # A list of branches whose builders should not use a shared buildroot.
88 non_shared_root_branches = Set(basestring), 101 non_shared_root_branches = Set(basestring),
89 102
90 # A list of branches whose builders checkout Chrome from SVN instead of Git. 103 # A list of branches whose builders checkout Chrome from SVN instead of Git.
91 chrome_svn_branches = Set(basestring), 104 chrome_svn_branches = Set(basestring),
92 105
106 # If "chromite_branch" includes a branch version, this will be set to the
107 # version value. Otherwise, this will be None.
108 #
109 # Set in "base".
110 branch_version = Single(int),
111
93 # Directory where a warm repo cache is stored. If set, and if the current 112 # Directory where a warm repo cache is stored. If set, and if the current
94 # build supports a warm cache, this will be used to bootstrap the Chromite 113 # build supports a warm cache, this will be used to bootstrap the Chromite
95 # checkout. 114 # checkout.
96 repo_cache_dir = Single(basestring) 115 repo_cache_dir = Single(basestring),
116
117 # The branch version where the "--git-cache" flag was introduced.
118 # Set to a ToT build after R54 branch, "release-R54-8743.B".
119 git_cache_min_branch_version = Single(int, empty_val=8829),
97 ) 120 )
98 121
99 config_ctx = config_item_context(BaseConfig) 122 config_ctx = config_item_context(BaseConfig)
100 123
101 124
102 @config_ctx() 125 @config_ctx()
103 def base(c): 126 def base(c):
104 c.repositories['tryjob'] = [] 127 c.repositories['tryjob'] = []
105 c.repositories['chromium'] = [] 128 c.repositories['chromium'] = []
106 c.repositories['cros_manifest'] = [] 129 c.repositories['cros_manifest'] = []
(...skipping 11 matching lines...) Expand all
118 c.chrome_svn_branches.update(( 141 c.chrome_svn_branches.update((
119 # TODO(dnj): Remove this once internal expectations are updated. 142 # TODO(dnj): Remove this once internal expectations are updated.
120 'factory-4455.B', 143 'factory-4455.B',
121 # TODO(dnj): Remove this once internal expectations are updated. 144 # TODO(dnj): Remove this once internal expectations are updated.
122 'factory-zako-5220.B', 145 'factory-zako-5220.B',
123 146
124 'factory-rambi-5517.B', 147 'factory-rambi-5517.B',
125 'factory-nyan-5772.B', 148 'factory-nyan-5772.B',
126 )) 149 ))
127 150
151 # Resolve branch version, if available.
152 assert c.chromite_branch, "A Chromite branch must be configured."
153 version = _VERSION_RE.match(c.chromite_branch)
154 if version:
155 c.branch_version = int(version.group(1))
156
128 # If running on a testing slave, enable "--debug" so Chromite doesn't cause 157 # If running on a testing slave, enable "--debug" so Chromite doesn't cause
129 # actual production effects. 158 # actual production effects.
130 if 'TESTING_MASTER_HOST' in os.environ: # pragma: no cover 159 if 'TESTING_MASTER_HOST' in os.environ: # pragma: no cover
131 c.cbb.debug = True 160 c.cbb.debug = True
132 161
133 162
134 @config_ctx(includes=['base']) 163 @config_ctx(includes=['base'])
164 def cros(c):
165 """Base configuration for CrOS builders to inherit from."""
166 # Enable Git cache on all ToT builds and release branches that support it.
167 if not (c.branch_version and
168 c.branch_version < c.git_cache_min_branch_version):
169 c.cbb.git_cache_dir = '/b/cros_git_cache'
170
171
172 @config_ctx(includes=['cros'])
135 def external(c): 173 def external(c):
136 c.repositories['tryjob'].extend([ 174 c.repositories['tryjob'].extend([
137 'https://chromium.googlesource.com/chromiumos/tryjobs', 175 'https://chromium.googlesource.com/chromiumos/tryjobs',
138 'https://chrome-internal.googlesource.com/chromeos/tryjobs', 176 'https://chrome-internal.googlesource.com/chromeos/tryjobs',
139 ]) 177 ])
140 c.repositories['chromium'].append( 178 c.repositories['chromium'].append(
141 'https://chromium.googlesource.com/chromium/src') 179 'https://chromium.googlesource.com/chromium/src')
142 c.repositories['cros_manifest'].append( 180 c.repositories['cros_manifest'].append(
143 'https://chromium.googlesource.com/chromiumos/manifest-versions') 181 'https://chromium.googlesource.com/chromiumos/manifest-versions')
144 182
(...skipping 24 matching lines...) Expand all
169 def chromiumos_coverage(c): 207 def chromiumos_coverage(c):
170 c.use_chrome_version = True 208 c.use_chrome_version = True
171 c.read_cros_manifest = True 209 c.read_cros_manifest = True
172 c.cbb.chrome_rev = 'stable' 210 c.cbb.chrome_rev = 'stable'
173 c.cbb.config_repo = 'https://example.com/repo.git' 211 c.cbb.config_repo = 'https://example.com/repo.git'
174 212
175 # TODO(dnj): Remove this config once variant support is removed. 213 # TODO(dnj): Remove this config once variant support is removed.
176 @config_ctx() 214 @config_ctx()
177 def coverage_variant(c): 215 def coverage_variant(c):
178 c.cbb.chrome_rev = 'canary' 216 c.cbb.chrome_rev = 'canary'
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698