在CI的Bazel配置中,使用以下代码来明确使用远程缓存:
bazel build --remote_cache=
bazel test --remote_cache=
bazel run --remote_cache=
同时,在WORKSPACE文件中,添加以下代码即可:
http_archive(
name = "build_bazel_remote_cache",
urls = ["https://github.com/buchgr/build-bazel-remote-cache/releases/download/0.26.0/build_bazel_remote_cache-0.26.0-linux-x86_64"],
ha256 = ""
)
其中,“build_bazel_remote_cache”是在Bazel中使用的远程缓存插件,
使用以上代码可以解决下载依赖项时不能从远程缓存中获取依赖项的问题。