Skip to content

Commit 3c4ddb8

Browse files
fredrectensorflower-gardener
authored andcommitted
Avoid copying the test logs when the Git repo dir and artifact dir are the same file.
This case can occur when running the CI script manually and would print a long list of warnings. PiperOrigin-RevId: 419435421
1 parent c98f026 commit 3c4ddb8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ci/kokoro/gcp_ubuntu/build.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ GIT_REPO_DIR="${GIT_REPO_DIR:-$DEFAULT_REPO_DIR}"
3838

3939
cleanup() {
4040
# Collect the test logs.
41-
docker exec tfmot find \
42-
-L "bazel-testlogs" \
43-
\( -name "test.log" -o -name "test.xml" \) \
44-
-exec cp --parents {} "${KOKORO_ARTIFACTS_DIR}" \;
41+
# Skipped when the container workdir is $KOKORO_ARTIFACTS_DIR.
42+
if docker exec tfmot test ! . -ef "${KOKORO_ARTIFACTS_DIR}"; then
43+
docker exec tfmot find \
44+
-L "bazel-testlogs" \
45+
\( -name "test.log" -o -name "test.xml" \) \
46+
-exec cp --parents {} "${KOKORO_ARTIFACTS_DIR}" \;
47+
fi
4548

4649
# Rename test.xml to sponge_log.xml so they show up in Sponge.
4750
docker exec tfmot find "${KOKORO_ARTIFACTS_DIR}/bazel-testlogs" \

0 commit comments

Comments
 (0)