branch-util: Fix branch-util-tryjob for testing.
branch-util has lots of special handling, which was broken for
branch-util-tryjob. Add the new config to the special case handling.
BUG=chromium:784985
TEST=cros tryjob --cbuildbot branch-util-tryjob --branch-name test_branch --version 10127.0.0
Change-Id: I718437dc85d5bead0530f0eef3b0bc1239cec7e6
Reviewed-on: https://chromium-review.googlesource.com/815675
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
diff --git a/cbuildbot/commands.py b/cbuildbot/commands.py
index d561150..9b8b599 100644
--- a/cbuildbot/commands.py
+++ b/cbuildbot/commands.py
@@ -334,11 +334,10 @@
with osutils.TempDir() as tempdir:
cmd = [
'cros', 'tryjob', '--local', '--yes',
- '--skip-remote-push',
'--branch-name', 'test_branch',
'--version', version,
'--buildroot', tempdir,
- 'branch-util',
+ 'branch-util-tryjob',
]
RunBuildScript(buildroot, cmd, chromite_cmd=True)
diff --git a/cbuildbot/stages/branch_stages.py b/cbuildbot/stages/branch_stages.py
index 7a29737..683ad6d 100644
--- a/cbuildbot/stages/branch_stages.py
+++ b/cbuildbot/stages/branch_stages.py
@@ -53,7 +53,7 @@
def __init__(self, builder_run, **kwargs):
super(BranchUtilStage, self).__init__(builder_run, **kwargs)
self.skip_remote_push = (self._run.options.skip_remote_push or
- self._run.options.debug_forced)
+ self._run.options.debug)
self.branch_name = self._run.options.branch_name
self.rename_to = self._run.options.rename_to
diff --git a/cbuildbot/stages/branch_stages_unittest.py b/cbuildbot/stages/branch_stages_unittest.py
index 5eb82d5..1232bb8 100644
--- a/cbuildbot/stages/branch_stages_unittest.py
+++ b/cbuildbot/stages/branch_stages_unittest.py
@@ -209,7 +209,8 @@
def testRelease(self):
"""Run-through of branch creation."""
- self._Prepare(extra_cmd_args=['--branch-name', self.RELEASE_BRANCH_NAME,
+ self._Prepare(extra_cmd_args=['--buildbot',
+ '--branch-name', self.RELEASE_BRANCH_NAME,
'--version', self.DEFAULT_VERSION])
# Simulate branch not existing.
self.rc_mock.AddCmdResult(
@@ -270,7 +271,8 @@
def testNonRelease(self):
"""Non-release branch creation."""
- self._Prepare(extra_cmd_args=['--branch-name', 'refs/heads/test-branch',
+ self._Prepare(extra_cmd_args=['--buildbot',
+ '--branch-name', 'refs/heads/test-branch',
'--version', self.DEFAULT_VERSION])
# Simulate branch not existing.
self.rc_mock.AddCmdResult(
@@ -291,7 +293,8 @@
def testDeletion(self):
"""Branch deletion."""
- self._Prepare(extra_cmd_args=['--branch-name', self.RELEASE_BRANCH_NAME,
+ self._Prepare(extra_cmd_args=['--buildbot',
+ '--branch-name', self.RELEASE_BRANCH_NAME,
'--delete-branch'])
self.rc_mock.AddCmdResult(
partial_mock.ListRegex('git show-ref .*release-test-branch.*'),
@@ -302,7 +305,8 @@
def testRename(self):
"""Branch rename."""
- self._Prepare(extra_cmd_args=['--branch-name', self.RELEASE_BRANCH_NAME,
+ self._Prepare(extra_cmd_args=['--buildbot',
+ '--branch-name', self.RELEASE_BRANCH_NAME,
'--rename-to', 'refs/heads/release-rename'])
# Simulate source branch existing and destination branch not existing.
self.rc_mock.AddCmdResult(
@@ -349,7 +353,8 @@
def _SimulateIncrementFailure(self):
"""Simulates a git push failure during source branch increment."""
- self._Prepare(extra_cmd_args=['--branch-name', self.RELEASE_BRANCH_NAME,
+ self._Prepare(extra_cmd_args=['--buildbot',
+ '--branch-name', self.RELEASE_BRANCH_NAME,
'--version', self.DEFAULT_VERSION])
overlay_dir = os.path.join(
self.build_root, constants.CHROMIUMOS_OVERLAY_DIR)
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 5496325..30328ba 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -627,7 +627,8 @@
# We force --debug to be set for builds that are not 'official'.
options.debug = options.debug or not options.buildbot
- if constants.BRANCH_UTIL_CONFIG in options.build_targets:
+ if (constants.BRANCH_UTIL_CONFIG in options.build_targets or
+ 'branch-util-tryjob' in options.build_targets):
if not options.branch_name:
cros_build_lib.Die(
'Must specify --branch-name with the %s config.',