Skip to content

Commit c40aff5

Browse files
committed
kokoro: add a light lint+test mode
To help reproduce kokoro failures locally, add an explicit mode that only runs lint & unittests, and never builds the plugin. Change-Id: Ia5ea6f146e16225247ca4dc6f83402c265875469 Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/6202067 Reviewed-by: Joel Hockey <[email protected]> Tested-by: kokoro <[email protected]>
1 parent 7219a1f commit c40aff5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

kokoro/build

+10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ DEPOT_TOOLS_URI = "https://chromium.googlesource.com/chromium/tools/depot_tools"
5050
DEPOT_TOOLS_DIR = kokoro.LIBAPPS_DIR / "depot_tools"
5151

5252

53+
def is_lint_test_only() -> bool:
54+
"""Whether we're only linting+testing the current tree."""
55+
# This env var is passed down by our script.
56+
return bool(os.environ.get("LIBAPPS_LINT_TEST"))
57+
58+
5359
def is_presubmit():
5460
"""Whether we're testing a pending CL."""
5561
# This env var is passed down by kokoro.
@@ -65,6 +71,10 @@ def should_build_plugin():
6571
"""
6672
logging.info("Detecting whether to build plugin")
6773

74+
if is_lint_test_only():
75+
logging.info("Only running lint+unittest")
76+
return False
77+
6878
# Release builders always build the plugin.
6979
if not is_presubmit():
7080
logging.info("Release builder: always building the plugin!")

kokoro/container

+3-1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ def run_docker(opts, docker_args=(), cmd_args=()):
138138
# The kokoro build detects this env var for presubmit.
139139
if opts.type == "presubmit":
140140
base_cmd += ["--env", "KOKORO_GERRIT_REVISION=HEAD"]
141+
elif opts.type == "lint-test":
142+
base_cmd += ["--env", "LIBAPPS_LINT_TEST=false"]
141143

142144
cmd = base_cmd + list(docker_args) + [CONTAINER_NAME] + list(cmd_args)
143145
return sudo_run(opts, cmd, cwd=libdot.LIBAPPS_DIR, check=False)
@@ -173,7 +175,7 @@ def get_parser():
173175
)
174176
parser.add_argument(
175177
"--type",
176-
choices=("presubmit", "release"),
178+
choices=("lint-test", "presubmit", "release"),
177179
default="presubmit",
178180
help="Type of build to run (default: %(default)s)",
179181
)

0 commit comments

Comments
 (0)