bazel-remote icon indicating copy to clipboard operation
bazel-remote copied to clipboard

Feature Request: Also support sha512

Open autoantwort opened this issue 4 months ago • 3 comments

We use bazel-remote as binarycache for vcpkg and it works great. We also want to use it as assetcache, but the problem is that vcpkg only supports sha512 instead of sha256 (source). I guess sha512 is not used in the bazel caching protocol, so I can understand when this request is out of scope.

Alternatives if out of scope: Use a reverse proxy that cuts the sha512 to a sha256 and use the action cache endpoints.

autoantwort avatar Aug 28 '25 13:08 autoantwort

Hi, adding full support for another hash besides sha256 is a lot of work, but I think you might be able to use a custom asset fetching script with vcpkg instead of a proxy server as you mentioned.

Here's an example which uses nuget: https://learn.microsoft.com/en-us/vcpkg/examples/asset-caching-source-nuget

You would need to run bazel-remote with the --disable_http_ac_validation flag, which might make it unsuitable for use with clients that use the cache server for other purposes that rely on this validation.

mostynb avatar Aug 28 '25 22:08 mostynb

I think it does not make a huge difference if I create a custom script for the requests or if I use a reverse proxy. My current Caddyfile:

:8084 {
        @sha512_to_sha256 {
                path_regexp sha512parts ^/assetcache/([a-f0-9]{64})([a-f0-9]{64})$
        }
        rewrite @sha512_to_sha256 /ac/{re.sha512parts.1}
        reverse_proxy localhost:8082
}

autoantwort avatar Aug 29 '25 15:08 autoantwort

If you find that this works well enough, we can add some example to the documentation.

mostynb avatar Aug 29 '25 18:08 mostynb