Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
|
nxia1
2016/09/28 21:45:31
any reason for not combining this with line 95? we
dnj
2016/09/28 22:52:16
List doesn't have a default value.
| |
| 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 | |
| 162 try: | |
| 163 branch_flag_idx = list(c.cbb.extra_args).index('--branch') + 1 | |
|
nxia1
2016/09/28 21:45:31
what happens when people pass in '--branch=master'
dnj
2016/09/28 22:52:16
Ugh is that something people do? I'll fix.
| |
| 164 if branch_flag_idx < len(c.cbb.extra_args): | |
| 165 chromite_branch = c.cbb.extra_args[branch_flag_idx] | |
|
nxia1
2016/09/28 22:00:03
and I'm confused why we can't overwrite c.chromite
dnj
2016/09/28 22:52:16
c.chrome_branch controls which branch of Chromite
nxia1
2016/09/29 00:36:44
Look I didn't find the cbb_branch settings in trys
nxia1
2016/09/29 00:37:52
Look -> Looks like :)
| |
| 166 except ValueError: | |
| 167 pass | |
| 168 | |
| 151 # Resolve branch version, if available. | 169 # Resolve branch version, if available. |
| 152 assert c.chromite_branch, "A Chromite branch must be configured." | 170 assert c.chromite_branch, "A Chromite branch must be configured." |
| 153 version = _VERSION_RE.match(c.chromite_branch) | 171 version = _VERSION_RE.match(chromite_branch) |
| 154 if version: | 172 if version: |
| 155 c.branch_version = int(version.group(1)) | 173 c.branch_version = int(version.group(1)) |
| 156 | 174 |
| 157 # If running on a testing slave, enable "--debug" so Chromite doesn't cause | 175 # If running on a testing slave, enable "--debug" so Chromite doesn't cause |
| 158 # actual production effects. | 176 # actual production effects. |
| 159 if 'TESTING_MASTER_HOST' in os.environ: # pragma: no cover | 177 if 'TESTING_MASTER_HOST' in os.environ: # pragma: no cover |
| 160 c.cbb.debug = True | 178 c.cbb.debug = True |
| 161 | 179 |
| 162 | 180 |
| 163 @config_ctx(includes=['base']) | 181 @config_ctx(includes=['base']) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 def chromiumos_coverage(c): | 225 def chromiumos_coverage(c): |
| 208 c.use_chrome_version = True | 226 c.use_chrome_version = True |
| 209 c.read_cros_manifest = True | 227 c.read_cros_manifest = True |
| 210 c.cbb.chrome_rev = 'stable' | 228 c.cbb.chrome_rev = 'stable' |
| 211 c.cbb.config_repo = 'https://example.com/repo.git' | 229 c.cbb.config_repo = 'https://example.com/repo.git' |
| 212 | 230 |
| 213 # TODO(dnj): Remove this config once variant support is removed. | 231 # TODO(dnj): Remove this config once variant support is removed. |
| 214 @config_ctx() | 232 @config_ctx() |
| 215 def coverage_variant(c): | 233 def coverage_variant(c): |
| 216 c.cbb.chrome_rev = 'canary' | 234 c.cbb.chrome_rev = 'canary' |
| OLD | NEW |