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 Runs Every Time Despite Using Remote Cache #2195

Open
aryeh-looker opened this issue Dec 12, 2022 · 3 comments
Open

Build Runs Every Time Despite Using Remote Cache #2195

aryeh-looker opened this issue Dec 12, 2022 · 3 comments
Labels
Can Close? Will close in 30 days unless there is a comment indicating why not

Comments

@aryeh-looker
Copy link

We are doing the following on CI:

    bazel build //... \
      --remote_cache=https://storage.googleapis.com/<path-to-bucket> \
      --google_default_credentials

We have a build target that uses rules docker that bazel runs every time, despite using the remote cache. It does not depend on other targets in our application, except for ones that are rarely modified. Is this expected behavior? It's not completely clear to me whether this is a bug. Any guidance on a workaround or otherwise would be appreciated. Unfortunately, the docker build target is expensive, as it involves compilation of third-party sources. We are looking at sharding the build on CI to multiple machines due to this issue.

@codersasha
Copy link

We're having the same issue. Bazel doesn't even seem to detect that it's a cacheable target - it reports a 100% cache hit rate.

@mikasun7
Copy link

mikasun7 commented Sep 29, 2023

i found ImageLayer is not "remote_cacheable",from the execution log(with option --execution_log_binary_file)

remote-cached:

listed_outputs: "bazel-out/k8-fastbuild/bin/apps/fc/ifbook/srcs/pubsub/[email protected]"
remotable: true
cacheable: true
progress_message: "SHA256 apps/fc/ifbook/srcs/pubsub/[email protected]"
mnemonic: "SHA256"
actual_outputs {
  path: "bazel-out/k8-fastbuild/bin/apps/fc/ifbook/srcs/pubsub/[email protected]"
  digest {
    hash: "55f9eac53ee92f92f3afefa32e1a9cecff3a98397df2ce81826b495a1e66209a"
    size_bytes: 64
    hash_function_name: "SHA-256"
  }
}
runner: "remote cache hit"
remote_cache_hit: true
remote_cacheable: true   # <--- here
walltime {
}

not remote-cached(remote_cacheable disappeared):

listed_outputs: "bazel-out/k8-fastbuild/bin/apps/fc/ifbook/srcs/pubsub/[email protected]"
remotable: true
cacheable: true
progress_message: "ImageLayer apps/fc/ifbook/srcs/pubsub/[email protected]"
mnemonic: "ImageLayer"
actual_outputs {
  path: "bazel-out/k8-fastbuild/bin/apps/fc/ifbook/srcs/pubsub/[email protected]"
  digest {
    hash: "664346b8273e5c46f88c70cf3717bf01a01a3f32d65472b6448058962bdd6109"
    size_bytes: 27709440
    hash_function_name: "SHA-256"
  }
}
runner: "processwrapper-sandbox"
walltime {
  nanos: 138000000
}

ImageLayer code: https://github.com/bazelbuild/rules_docker/blob/master/container/layer.bzl#L170

Copy link

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

@github-actions github-actions bot added the Can Close? Will close in 30 days unless there is a comment indicating why not label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? Will close in 30 days unless there is a comment indicating why not
Projects
None yet
Development

No branches or pull requests

3 participants