From 49c1659695e3c35d1879ebe8ee0c3a3e94fe5a34 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 20 May 2019 10:54:11 -0700 Subject: [PATCH] getdeps: allow tagging a build with its schedule type Summary: The schedule type is used to differentiate between a build run during code review (and thus runs code that isn't yet in the master branch), from continuous or other types of run that operate on landed code. This doesn't change any behavior yet; this diff just adds the plumbing to pass down an optional arbitrary schedule type string from the CI system. In the future, we'll use the schedule type to influence the behavior of running tests. Reviewed By: strager Differential Revision: D15300120 fbshipit-source-id: 3b46afef2ff171b3fa095763dd5006a54ea328b8 --- build/fbcode_builder/getdeps.py | 8 +++++++- build/fbcode_builder/getdeps/builder.py | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build/fbcode_builder/getdeps.py b/build/fbcode_builder/getdeps.py index e669b56d3..5953338b0 100755 --- a/build/fbcode_builder/getdeps.py +++ b/build/fbcode_builder/getdeps.py @@ -302,6 +302,9 @@ class BuildCmd(SubCmd): "is able to execute tests" ), ) + parser.add_argument( + "--schedule-type", help="Indicates how the build was activated" + ) @cmd("test", "test a given project") @@ -336,7 +339,7 @@ class TestCmd(SubCmd): return 1 src_dir = fetcher.get_src_dir() builder = m.create_builder(opts, src_dir, build_dir, inst_dir, ctx) - builder.run_tests(install_dirs) + builder.run_tests(install_dirs, schedule_type=args.schedule_type) install_dirs.append(inst_dir) @@ -354,6 +357,9 @@ class TestCmd(SubCmd): default=False, help="Enable running tests for the named project and all of its deps", ) + parser.add_argument( + "--schedule-type", help="Indicates how the build was activated" + ) def build_argparser(): diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index b886defa3..39c7bc49c 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -86,7 +86,7 @@ class BuilderBase(object): self._build(install_dirs=install_dirs, reconfigure=reconfigure) - def run_tests(self, install_dirs): + def run_tests(self, install_dirs, schedule_type): """ Execute any tests that we know how to run. If they fail, raise an exception. """ pass @@ -279,7 +279,7 @@ class CMakeBuilder(BuilderBase): env=env, ) - def run_tests(self, install_dirs): + def run_tests(self, install_dirs, schedule_type): env = self._compute_env(install_dirs) ctest = path_search(env, "ctest") cmake = path_search(env, "cmake")