Skip to content

Commit 3778377

Browse files
authored
chore(python): detect when samples testing requires custom dockerfile (#1277)
* chore(python): automatically detect when samples testing requires custom dockerfile * address review feedback * lint
1 parent c817fb4 commit 3778377

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

synthtool/gcp/common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ def py_library(self, **kwargs) -> Path:
266266
if Path("google/cloud").exists():
267267
kwargs["is_google_cloud_api"] = True
268268

269-
# Assume the python-docs-samples Dockerfile is used for samples by default
270-
if "custom_samples_dockerfile" not in kwargs:
271-
kwargs["custom_samples_dockerfile"] = False
269+
# If Dockerfile exists in .kokoro/docker/samples, add kwargs to
270+
# signal that a custom docker image should be used when testing samples.
271+
kwargs["custom_samples_dockerfile"] = Path(
272+
".kokoro/docker/samples/Dockerfile"
273+
).exists()
272274

273275
ret = self._generic_library("python_library", **kwargs)
274276

0 commit comments

Comments
 (0)