Hi,
rules_go downloads the Go toolchain as part of the build process via repository_ctx.download_and_extract:
For example, on Linux/amd64 for Go 1.8.3 it downloads the tarball
which is 86MB in size.
Several developers, including myself, have observed that this download occurs more often than expected. Go 1.8.3 was released three months ago, the tarball has not changed since, and yet we see Bazel re-downloading it fairly often (say, a few times per week). For people on slow network connections, notably our people working remotely working via VPN, these re-downloads significantly slow down the builds, easily adding several unnecessary minutes to the build. It is not clear what changes trigger a re-download.
Barring "bazel clean", what would cause Bazel to decide that it needs to re-download the tarball and how can we avoid this?
Many thanks,
Tom
Random factoids that might assist diagnosis:
- This is all on macOS and we're generally tracking the latest release of Bazel (0.5.2, 0.5.3, 0.5.4...).
- We're using rules_go at tag 0.5.3.
- The VCS is git, and developers are regularly switching branches, some of which might have different WORKSPACE contents.
- The top-level WORKSPACE file changes approximately weekly, usually in response to changes in rules_go (e.g. to use a newer tag or take advantage of a new feature in rules_go).
- We have a local copy of rules_go in our repository so we don't need GitHub to be up when doing a clean build.
- Our WORKSPACE file contains:
local_repository(
name = "io_bazel_rules_go",
)
load("@io_bazel_rules_go//go:def.bzl", "go_repositories")
go_repositories(go_version="1.8.3")