Chromium Code Reviews| Index: scripts/slave/recipe_modules/chromite/config.py |
| diff --git a/scripts/slave/recipe_modules/chromite/config.py b/scripts/slave/recipe_modules/chromite/config.py |
| index ef39cb3490c4c33317c9e889fcef5e3df892b9f5..daee1840cf7c81773c03042ebce265a9fb40eb90 100644 |
| --- a/scripts/slave/recipe_modules/chromite/config.py |
| +++ b/scripts/slave/recipe_modules/chromite/config.py |
| @@ -6,7 +6,7 @@ import os |
| import re |
| from recipe_engine.config import config_item_context, ConfigGroup |
| -from recipe_engine.config import Dict, Single, Set |
| +from recipe_engine.config import Dict, Single, List, Set |
| # Regular expression to match branch versions. |
| @@ -21,8 +21,8 @@ _VERSION_RE = re.compile(r'^.*-(\d+)\.(\d+\.)?B$') |
| def BaseConfig(CBB_CONFIG=None, CBB_BRANCH=None, CBB_BUILD_NUMBER=None, |
| CBB_DEBUG=False, CBB_CLOBBER=False, CBB_BUILDBUCKET_ID=None, |
| - CBB_MASTER_BUILD_ID=None, **_kwargs): |
| - return ConfigGroup( |
| + CBB_MASTER_BUILD_ID=None, CBB_EXTRA_ARGS=None, **_kwargs): |
| + cgrp = ConfigGroup( |
| # Base mapping of repository key to repository name. |
| repositories = Dict(value_type=Set(basestring)), |
| @@ -89,7 +89,10 @@ def BaseConfig(CBB_CONFIG=None, CBB_BRANCH=None, CBB_BUILD_NUMBER=None, |
| git_cache_dir = Single(basestring), |
| # If supplied, forward to cbuildbot as '--buildbucket-id' |
| - buildbucket_id = Single(basestring, empty_val=CBB_BUILDBUCKET_ID) |
| + buildbucket_id = Single(basestring, empty_val=CBB_BUILDBUCKET_ID), |
| + |
| + # Extra arguments passed to cbuildbot. |
| + extra_args = List(basestring), |
| ), |
| # A list of branches whose Chromite version is "old". Old Chromite |
| @@ -119,6 +122,11 @@ def BaseConfig(CBB_CONFIG=None, CBB_BRANCH=None, CBB_BUILD_NUMBER=None, |
| git_cache_min_branch_version = Single(int, empty_val=8829), |
| ) |
| + if CBB_EXTRA_ARGS: |
| + 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.
|
| + return cgrp |
| + |
| + |
| config_ctx = config_item_context(BaseConfig) |
| @@ -148,9 +156,19 @@ def base(c): |
| 'factory-nyan-5772.B', |
| )) |
| + # Determine if we're manually specifying the tryjob branch in the extra |
| + # args. If we are, use that as the branch version. |
| + chromite_branch = c.chromite_branch |
| + try: |
| + 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.
|
| + if branch_flag_idx < len(c.cbb.extra_args): |
| + 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 :)
|
| + except ValueError: |
| + pass |
| + |
| # Resolve branch version, if available. |
| assert c.chromite_branch, "A Chromite branch must be configured." |
| - version = _VERSION_RE.match(c.chromite_branch) |
| + version = _VERSION_RE.match(chromite_branch) |
| if version: |
| c.branch_version = int(version.group(1)) |