question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bazel combined cache not working with GCP Storage

See original GitHub issue

Description of the bug:

As of 5.2.0, Bazel doesn’t download from GCP storage when the disk cache is used.

What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

WORKSPACE.bazel

BUILD.bazel

genrule(
  name = "example",
  cmd = "date; echo example > $@",
  outs = ["example.txt"],
)

.bazelrc

build --disk_cache=~/.cache/bazel-disk
build --google_default_credentials
build --remote_cache=https://storage.googleapis.com/example-bucket

Build:

bazel build :example

Then clean:

bazel clean
rm -r ~/.cache/bazel-disk/*

Then build again:

bazel build :example

The output for the last step shows: 2 processes: 1 internal, 1 linux-sandbox.

It ought to display: 2 processes: 1 remote cache hit, 1 internal.

Which operating system are you running Bazel on?

Ubuntu 20.04

What is the output of bazel info release?

release 5.2.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What’s the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Oddly, this works as expected if I do any one of the following:

  1. Remove the --disk_cache option.
  2. Use a local HTTP server (nginx) instead of GCP Storage.
  3. Use Bazel 5.1.0.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
tjgqcommented, Jul 28, 2022

Sorry, copy paste error. I meant it was fixed by 40e485dc67 (originally https://github.com/bazelbuild/bazel/pull/15842).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Cloud Storage Cache Strategy · Issue #2512 - GitHub
The main problem currently is that Bazel has no good mechanism for consulting a cache prior to actually executing an action. @ulfjack and...
Read more >
Remote Caching - Bazel
This page covers remote caching, setting up a server to host the cache, and running builds using the remote cache. A remote cache...
Read more >
Remote Cache with Google Cloud Storage provides no net ...
On a side note, when I was tuning Cirrus CI's HTTP Cache for Bazel I noticed that Bazel uploads and downloads a lot...
Read more >
Fast, cheap and globally accessible Bazel remote cache on ...
Bazel implements remote caching over several protocols: HTTP/WebDAV, gRPC and Google Cloud Storage (which is HTTP really).
Read more >
Setting up a shared build cache using Bazel - Tweag
Action outputs can be cached, so that running another build does not require executing all actions again. There are two levels of caching...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found