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

build: map in the full teamcity alternates directory #47799

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions build/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,15 @@ vols="${vols} --volume=${HOME}/.yarn-cache:${container_home}/.yarn-cache${cached

# If we're running in an environment that's using git alternates, like TeamCity,
# we must mount the path to the real git objects for git to work in the container.
alternates_file=${cockroach_toplevel}/.git/objects/info/alternates
if test -e "${alternates_file}"; then
alternates_path=$(cat "${alternates_file}")
vols="${vols} --volume=${alternates_path}:${alternates_path}${cached_volume_mode}"
# alternates_file=${cockroach_toplevel}/.git/objects/info/alternates
# if test -e "${alternates_file}"; then
# alternates_path=$(cat "${alternates_file}")
# vols="${vols} --volume=${alternates_path}:${alternates_path}${cached_volume_mode}"
# fi

teamcity_alternates="/home/agent/system/git/"
if test -d "${teamcity_alternates}"; then
vols="${vols} --volume=${teamcity_alternates}:${teamcity_alternates}${cached_volume_mode}"
Copy link
Member

Choose a reason for hiding this comment

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

Could we dirname the result of the previous version? I think that would do the trick without being as TC specific.

Copy link
Member

Choose a reason for hiding this comment

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

So alternates_path=$(dirname $(cat "${alternates_file}"))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably. I'm just looking for the sledgehammer fix here. We can follow-up with a cleaner fix if this PR actually works.

I think we could also look for alternates files in other .git directories.

fi

if [ "${BUILDER_HIDE_GOPATH_SRC:-}" != "1" ]; then
Expand Down