buchgr / bazel-remote

A remote cache for Bazel
https://bazel.build
Apache License 2.0
576 stars 150 forks source link

It appears that remote downloader does not pass HTTP headers #758

Closed marekkrk closed 1 month ago

marekkrk commented 1 month ago

When working with Bazel OCI rules I can download images from a local Docker registry with remote downloader disabled.

When I enable --experimental_remote_downloader, OCI rules fail to download images and the local Docker registry logs the following error: "OCI manifest found, but accept header does not support OCI manifests"

This indicates that the remote downloader does not support headers passed to repository_ctx.download. Support for settings cutom headers is implemented in Bazel itself: https://github.com/bazelbuild/bazel/issues/17829 https://blog.aspect.build/custom-download-headers

mostynb commented 1 month ago

Hi, I'm not sure how this relates to bazel-remote?

xuzhenglun commented 1 month ago

I submit a simple PR to support this. could u plz @marekkrk test for that ?

https://github.com/buchgr/bazel-remote/pull/760

For me, I'm a user of rules_oci, but rules_oci still not works even though all headers are handled. Since it looks like theAuthorization in ctx.download.auth params still not passthrough to FetchBlob now.

marekkrk commented 1 month ago

Hi, I'm not sure how this relates to bazel-remote?

If you use --experimental_remote_downloader to delegate HTTP downloads from Bazel to Bazel Remote Cache, the cache appears to omit custom HTTP headers that Bazel itself supports since 7.1.0: https://github.com/bazelbuild/bazel/issues/17829

mostynb commented 1 month ago

Merged @xuzhenglun's PR, hopefully that resolves this issue- please let me know if not.

marekkrk commented 1 month ago

Merged @xuzhenglun's PR, hopefully that resolves this issue- please let me know if not.

Thanks, will test by tomorrow.