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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c445421a4d3d3da829df708d9c81862e8f6e6e35 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
+ return cgrp
+
+
config_ctx = config_item_context(BaseConfig)
@@ -148,9 +156,26 @@ 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
nxia1 2016/10/31 21:56:55 any reason we don't overwrite c.chromite_branch wi
+ for idx, arg in enumerate(c.cbb.extra_args):
+ if arg == '--branch':
+ # Two-argument form: "--branch master"
+ idx += 1
+ if idx < len(c.cbb.extra_args):
+ chromite_branch = c.cbb.extra_args[idx]
+ break
+
+ # One-argument form: "--branch=master"
+ branch_flag = '--branch'
+ if arg.startswith(branch_flag):
+ chromite_branch = arg[len(branch_flag):]
+ break
+
# 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))
@@ -164,7 +189,7 @@ def base(c):
def cros(c):
"""Base configuration for CrOS builders to inherit from."""
# Enable Git cache on all ToT builds and release branches that support it.
- if not (c.branch_version and
+ if not (c.branch_version is not None and
c.branch_version < c.git_cache_min_branch_version):
c.cbb.git_cache_dir = '/b/cros_git_cache'
« 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