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

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

Issue 2374543006: Base flags on bootstrapped Chromite branch. (Closed)
Patch Set: Handle alternative branch parameter. 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 re 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, List, Set
10 10
11 11
12 # Regular expression to match branch versions. 12 # Regular expression to match branch versions.
13 # 13 #
14 # Examples: 14 # Examples:
15 # - release-R54-8743.B 15 # - release-R54-8743.B
16 # - stabilize-8743.B 16 # - stabilize-8743.B
17 # - factory-gale-8743.19.B 17 # - factory-gale-8743.19.B
18 # - stabilize-8743.25.B 18 # - stabilize-8743.25.B
19 _VERSION_RE = re.compile(r'^.*-(\d+)\.(\d+\.)?B$') 19 _VERSION_RE = re.compile(r'^.*-(\d+)\.(\d+\.)?B$')
20 20
21 21
22 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,
23 CBB_DEBUG=False, CBB_CLOBBER=False, CBB_BUILDBUCKET_ID=None, 23 CBB_DEBUG=False, CBB_CLOBBER=False, CBB_BUILDBUCKET_ID=None,
24 CBB_MASTER_BUILD_ID=None, **_kwargs): 24 CBB_MASTER_BUILD_ID=None, CBB_EXTRA_ARGS=None, **_kwargs):
25 return ConfigGroup( 25 cgrp = ConfigGroup(
26 # Base mapping of repository key to repository name. 26 # Base mapping of repository key to repository name.
27 repositories = Dict(value_type=Set(basestring)), 27 repositories = Dict(value_type=Set(basestring)),
28 28
29 # Checkout Chromite at this branch. "origin/" will be prepended. 29 # Checkout Chromite at this branch. "origin/" will be prepended.
30 chromite_branch = Single(basestring, empty_val=CBB_BRANCH or 'master'), 30 chromite_branch = Single(basestring, empty_val=CBB_BRANCH or 'master'),
31 31
32 # Should the Chrome version be supplied to cbuildbot? 32 # Should the Chrome version be supplied to cbuildbot?
33 use_chrome_version = Single(bool), 33 use_chrome_version = Single(bool),
34 34
35 # Should the CrOS manifest commit message be parsed and added to 'cbuildbot' 35 # Should the CrOS manifest commit message be parsed and added to 'cbuildbot'
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 disable_bootstrap = Single(bool), 82 disable_bootstrap = Single(bool),
83 83
84 # Whether this Chromite version supports warm cache. 84 # Whether this Chromite version supports warm cache.
85 # https://chromium-review.googlesource.com/#/c/348011 85 # https://chromium-review.googlesource.com/#/c/348011
86 supports_repo_cache = Single(bool), 86 supports_repo_cache = Single(bool),
87 87
88 # If set, supply the "--git-cache-dir" option with this value. 88 # If set, supply the "--git-cache-dir" option with this value.
89 git_cache_dir = Single(basestring), 89 git_cache_dir = Single(basestring),
90 90
91 # If supplied, forward to cbuildbot as '--buildbucket-id' 91 # If supplied, forward to cbuildbot as '--buildbucket-id'
92 buildbucket_id = Single(basestring, empty_val=CBB_BUILDBUCKET_ID) 92 buildbucket_id = Single(basestring, empty_val=CBB_BUILDBUCKET_ID),
93
94 # Extra arguments passed to cbuildbot.
95 extra_args = List(basestring),
93 ), 96 ),
94 97
95 # A list of branches whose Chromite version is "old". Old Chromite 98 # A list of branches whose Chromite version is "old". Old Chromite
96 # buildbot commands reside in the "buildbot" subdirectory of the Chromite 99 # buildbot commands reside in the "buildbot" subdirectory of the Chromite
97 # repository instead of the "bin". 100 # repository instead of the "bin".
98 old_chromite_branches = Set(basestring), 101 old_chromite_branches = Set(basestring),
99 102
100 # A list of branches whose builders should not use a shared buildroot. 103 # A list of branches whose builders should not use a shared buildroot.
101 non_shared_root_branches = Set(basestring), 104 non_shared_root_branches = Set(basestring),
102 105
103 # A list of branches whose builders checkout Chrome from SVN instead of Git. 106 # A list of branches whose builders checkout Chrome from SVN instead of Git.
104 chrome_svn_branches = Set(basestring), 107 chrome_svn_branches = Set(basestring),
105 108
106 # If "chromite_branch" includes a branch version, this will be set to the 109 # If "chromite_branch" includes a branch version, this will be set to the
107 # version value. Otherwise, this will be None. 110 # version value. Otherwise, this will be None.
108 # 111 #
109 # Set in "base". 112 # Set in "base".
110 branch_version = Single(int), 113 branch_version = Single(int),
111 114
112 # Directory where a warm repo cache is stored. If set, and if the current 115 # Directory where a warm repo cache is stored. If set, and if the current
113 # build supports a warm cache, this will be used to bootstrap the Chromite 116 # build supports a warm cache, this will be used to bootstrap the Chromite
114 # checkout. 117 # checkout.
115 repo_cache_dir = Single(basestring), 118 repo_cache_dir = Single(basestring),
116 119
117 # The branch version where the "--git-cache" flag was introduced. 120 # The branch version where the "--git-cache" flag was introduced.
118 # Set to a ToT build after R54 branch, "release-R54-8743.B". 121 # Set to a ToT build after R54 branch, "release-R54-8743.B".
119 git_cache_min_branch_version = Single(int, empty_val=8829), 122 git_cache_min_branch_version = Single(int, empty_val=8829),
120 ) 123 )
121 124
125 if CBB_EXTRA_ARGS:
126 cgrp.cbb.extra_args = CBB_EXTRA_ARGS
127 return cgrp
128
129
122 config_ctx = config_item_context(BaseConfig) 130 config_ctx = config_item_context(BaseConfig)
123 131
124 132
125 @config_ctx() 133 @config_ctx()
126 def base(c): 134 def base(c):
127 c.repositories['tryjob'] = [] 135 c.repositories['tryjob'] = []
128 c.repositories['chromium'] = [] 136 c.repositories['chromium'] = []
129 c.repositories['cros_manifest'] = [] 137 c.repositories['cros_manifest'] = []
130 c.repo_cache_dir = '/var/cache/chrome-infra/ccompute-setup/cros-internal' 138 c.repo_cache_dir = '/var/cache/chrome-infra/ccompute-setup/cros-internal'
131 139
132 c.old_chromite_branches.update(( 140 c.old_chromite_branches.update((
133 'firmware-uboot_v2-1299.B', 141 'firmware-uboot_v2-1299.B',
134 # TODO(dnj): Remove this once internal expectations are updated. 142 # TODO(dnj): Remove this once internal expectations are updated.
135 'factory-1412.B', 143 'factory-1412.B',
136 )) 144 ))
137 c.non_shared_root_branches.update(c.old_chromite_branches) 145 c.non_shared_root_branches.update(c.old_chromite_branches)
138 c.non_shared_root_branches.update(( 146 c.non_shared_root_branches.update((
139 'factory-2305.B', 147 'factory-2305.B',
140 )) 148 ))
141 c.chrome_svn_branches.update(( 149 c.chrome_svn_branches.update((
142 # TODO(dnj): Remove this once internal expectations are updated. 150 # TODO(dnj): Remove this once internal expectations are updated.
143 'factory-4455.B', 151 'factory-4455.B',
144 # TODO(dnj): Remove this once internal expectations are updated. 152 # TODO(dnj): Remove this once internal expectations are updated.
145 'factory-zako-5220.B', 153 'factory-zako-5220.B',
146 154
147 'factory-rambi-5517.B', 155 'factory-rambi-5517.B',
148 'factory-nyan-5772.B', 156 'factory-nyan-5772.B',
149 )) 157 ))
150 158
159 # Determine if we're manually specifying the tryjob branch in the extra
160 # args. If we are, use that as the branch version.
161 chromite_branch = c.chromite_branch
nxia1 2016/10/31 21:56:55 any reason we don't overwrite c.chromite_branch wi
162 for idx, arg in enumerate(c.cbb.extra_args):
163 if arg == '--branch':
164 # Two-argument form: "--branch master"
165 idx += 1
166 if idx < len(c.cbb.extra_args):
167 chromite_branch = c.cbb.extra_args[idx]
168 break
169
170 # One-argument form: "--branch=master"
171 branch_flag = '--branch'
172 if arg.startswith(branch_flag):
173 chromite_branch = arg[len(branch_flag):]
174 break
175
151 # Resolve branch version, if available. 176 # Resolve branch version, if available.
152 assert c.chromite_branch, "A Chromite branch must be configured." 177 assert c.chromite_branch, "A Chromite branch must be configured."
153 version = _VERSION_RE.match(c.chromite_branch) 178 version = _VERSION_RE.match(chromite_branch)
154 if version: 179 if version:
155 c.branch_version = int(version.group(1)) 180 c.branch_version = int(version.group(1))
156 181
157 # If running on a testing slave, enable "--debug" so Chromite doesn't cause 182 # If running on a testing slave, enable "--debug" so Chromite doesn't cause
158 # actual production effects. 183 # actual production effects.
159 if 'TESTING_MASTER_HOST' in os.environ: # pragma: no cover 184 if 'TESTING_MASTER_HOST' in os.environ: # pragma: no cover
160 c.cbb.debug = True 185 c.cbb.debug = True
161 186
162 187
163 @config_ctx(includes=['base']) 188 @config_ctx(includes=['base'])
164 def cros(c): 189 def cros(c):
165 """Base configuration for CrOS builders to inherit from.""" 190 """Base configuration for CrOS builders to inherit from."""
166 # Enable Git cache on all ToT builds and release branches that support it. 191 # Enable Git cache on all ToT builds and release branches that support it.
167 if not (c.branch_version and 192 if not (c.branch_version is not None and
168 c.branch_version < c.git_cache_min_branch_version): 193 c.branch_version < c.git_cache_min_branch_version):
169 c.cbb.git_cache_dir = '/b/cros_git_cache' 194 c.cbb.git_cache_dir = '/b/cros_git_cache'
170 195
171 196
172 @config_ctx(includes=['cros']) 197 @config_ctx(includes=['cros'])
173 def external(c): 198 def external(c):
174 c.repositories['tryjob'].extend([ 199 c.repositories['tryjob'].extend([
175 'https://chromium.googlesource.com/chromiumos/tryjobs', 200 'https://chromium.googlesource.com/chromiumos/tryjobs',
176 'https://chrome-internal.googlesource.com/chromeos/tryjobs', 201 'https://chrome-internal.googlesource.com/chromeos/tryjobs',
177 ]) 202 ])
(...skipping 29 matching lines...) Expand all
207 def chromiumos_coverage(c): 232 def chromiumos_coverage(c):
208 c.use_chrome_version = True 233 c.use_chrome_version = True
209 c.read_cros_manifest = True 234 c.read_cros_manifest = True
210 c.cbb.chrome_rev = 'stable' 235 c.cbb.chrome_rev = 'stable'
211 c.cbb.config_repo = 'https://example.com/repo.git' 236 c.cbb.config_repo = 'https://example.com/repo.git'
212 237
213 # TODO(dnj): Remove this config once variant support is removed. 238 # TODO(dnj): Remove this config once variant support is removed.
214 @config_ctx() 239 @config_ctx()
215 def coverage_variant(c): 240 def coverage_variant(c):
216 c.cbb.chrome_rev = 'canary' 241 c.cbb.chrome_rev = 'canary'
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/chromite/api.py ('k') | scripts/slave/recipes/cros/cbuildbot_tryjob.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698