Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make bazel not follow the infinite symlink in _output/local/go #71524

Merged
merged 1 commit into from
Nov 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,15 @@ kube::golang::create_gopath_tree() {
ln -snf "${KUBE_ROOT}" "${go_pkg_dir}"
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# 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
ixdy marked this conversation as resolved.
Show resolved Hide resolved
# infinite loop created by the symlink at
# ${go_pkg_dir}
Expand Down