bazelbuild/bazel

Add switch to enable rctx.download() remote caching even if sha256 is not specified

Open

#26763 opened on Aug 13, 2025

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Java (25,384 stars) (4,465 forks)batch import
P2help wantedteam-Remote-Exectype: feature request

Description

Description of the feature request:

The resolution of https://github.com/bazelbuild/bazel/issues/23932 was to disable remote caching (e.g. when using experimental_remote_downloader) of rctx.download() resources if no sha256 is specified, since that usually is an indicator that the resource is intentionally ephemeral.

However in some cases the sha256 is omitted, but integrity still happens later some other way in the repo rule. For example if fetching packages from a go.mod file, we won't have sha256s but we can still check integrity manually via the go.sum file.

In these cases, we do want the resource to be remotely cacheable even though a sha256 is not specified.

Can we add an option to download/download_and_extract to opt-in to remote caching, such as force_allow_caching = True? Essentially if set it would skip over the logic introduced in https://github.com/bazelbuild/bazel/pull/23995.

Which category does this issue belong to?

External Dependency, Remote Execution

What underlying problem are you trying to solve with this feature?

To enable remote caching (e.g. using experimental_remote_downloader) of manually verified rctx.download() resources that omit a sha256 parameter.

Which operating system are you running Bazel on?

macos

What is the output of bazel info release?

release 8.3.1

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 HEAD ?

Have you found anything relevant by searching the web?

No response

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

No response

Contributor guide