Unverified Commit be6ce4ac authored by k8s-ci-robot's avatar k8s-ci-robot Committed by GitHub

Merge pull request #71524 from ixdy/bazel-_output-local-go

make bazel not follow the infinite symlink in _output/local/go
parents dda9637f e3fac769
...@@ -354,7 +354,15 @@ kube::golang::create_gopath_tree() { ...@@ -354,7 +354,15 @@ kube::golang::create_gopath_tree() {
ln -snf "${KUBE_ROOT}" "${go_pkg_dir}" ln -snf "${KUBE_ROOT}" "${go_pkg_dir}"
fi fi
cat >"${KUBE_GOPATH}/BUILD" <<EOF # Using bazel with a recursive target (e.g. bazel test ...) will abort due to
# the symlink loop created in this function, so create this special file which
# tells bazel not to follow the symlink.
touch "${go_pkg_basedir}/DONT_FOLLOW_SYMLINKS_WHEN_TRAVERSING_THIS_DIRECTORY_VIA_A_RECURSIVE_TARGET_PATTERN"
# Additionally, the //:package-srcs glob recursively includes all
# subdirectories, and similarly fails due to the symlink loop. By creating a
# BUILD.bazel file, we effectively create a dummy package, which stops the
# glob from descending further into the tree and hitting the loop.
cat >"${KUBE_GOPATH}/BUILD.bazel" <<EOF
# This dummy BUILD file prevents Bazel from trying to descend through the # This dummy BUILD file prevents Bazel from trying to descend through the
# infinite loop created by the symlink at # infinite loop created by the symlink at
# ${go_pkg_dir} # ${go_pkg_dir}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment