Allow repository rules to perform integrity checks
#15 759 ouverte le 28 juin 2022
Métriques du dépôt
- Stars
- (25 384 stars)
- Métriques de merge PR
- (Merge moyen 22j 20h) (77 PRs mergées en 30 j)
Description
Description of the feature request:
Repository rules should be able to perform integrity checks or calculate the integrity of files.
Something like:
# where ctx is repository_ctx
integrity = ctx.calculate_integrity(file = "some_file.txt")
# the format of the integrity object could be:
integrity == struct(
sha1 = "",
sha256 = "",
sha384 = "",
sha512 = "",
)
ctx.verify_integrity(
file = "some_file.txt",
integrity = "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC",
)
Alternatively, there could be just one ctx.integrity function which will both calculate and verify depending on whether the integrity attribute is given?
What underlying problem are you trying to solve with this feature?
There are cases where resources cannot be fetched over HTTP and external tools must be used. In such case, it would be nice to have a native way to verify integrity without having to rely on the host to have sha256sum, openssl, etc installed.
Which operating system are you running Bazel on?
Linux
What is the output of bazel info release?
5.2.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 master; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
Not much.
https://github.com/bazelbuild/bazel/issues/7323
Any other information, logs, or outputs that you want to share?
No response