cbuildbot: Enforce tryjob safe configs.
Require either --buildbot or --debug to run a non-tryjob safe build
config. This ensures that production build configs can't be launched
in an unsafe way by either old versions of cros tryjob, or on
branches.
BUG=chromium:776955
TEST=run_tests
Change-Id: I83a97b662044ea0ee79f56114b5807d17471eab6
Reviewed-on: https://chromium-review.googlesource.com/759222
Commit-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Ningning Xia <nxia@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index a6acb83..f63d6d1 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -709,6 +709,14 @@
if build_config.debug:
options.debug = True
+ if not (config_lib.isTryjobConfig(build_config) or
+ options.buildbot or
+ options.debug):
+ cros_build_lib.Die(
+ 'Refusing to run non-tryjob config as a tryjob.\n'
+ 'Please see "repo sync && cros tryjob --list %s" for alternatives.',
+ build_config.name)
+
# The --version option is not compatible with an external target unless the
# --buildbot option is specified. More correctly, only "paladin versions"
# will work with external targets, and those are only used with --buildbot.