Remove SHA checksum for bazel http_archive from GitHub (#95039)

An action item from https://github.com/pytorch/pytorch/issues/94346

Although the security practice of setting the checksum is good, it doesn't work when the archive is downloaded from some sites like GitHub because it can change. Specifically, GitHub gives no guarantee to keep the same value forever https://github.com/community/community/discussions/46034.

This also adds a new linter to make sure that SHA checksum from GitHub can be removed quickly.  The WORKSPACE file is actually updated using the new linter:

```
>>> Lint for WORKSPACE:

  Advice (BAZEL_LINTER) format
    Redundant SHA checksum. Run `lintrunner -a` to apply this patch.

    You can run `lintrunner -a` to apply this patch.

     5   5 |
     6   6 | http_archive(
     7   7 |     name = "rules_cuda",
     7     |-    sha256 = "f80438bee9906e9ecb1a8a4ae2365374ac1e8a283897281a2db2fb7fcf746333",
     9   8 |     strip_prefix = "runtime-b1c7cce21ba4661c17ac72421c6a0e2015e7bef3/third_party/rules_cuda",
    10   9 |     urls = ["b1c7cce21b.tar.gz"],
    11  10 | )
--------------------------------------------------------------------------------
    29  28 |   name = "pybind11_bazel",
    30  29 |   strip_prefix = "pybind11_bazel-992381ced716ae12122360b0fbadbc3dda436dbf",
    31  30 |   urls = ["992381ced7.zip"],
    31     |-  sha256 = "3dc6435bd41c058453efe102995ef084d0a86b0176fd6a67a6b7100a2e9a940e",
    33  31 | )
    34  32 |
    35  33 | new_local_repository(
--------------------------------------------------------------------------------
    52  50 |     urls = [
    53  51 |         "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
    54  52 |     ],
    54     |-    sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
    56  53 | )
    57  54 |
    58  55 | new_local_repository(
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/95039
Approved by: https://github.com/ZainRizvi
This commit is contained in:
Huy Do
2023-02-22 04:39:19 +00:00
committed by PyTorch MergeBot
parent 8d22eb61aa
commit 2f547ae613
4 changed files with 206 additions and 3 deletions

View File

@ -5,7 +5,6 @@ load("//tools/rules:workspace.bzl", "new_patched_local_repository")
http_archive(
name = "rules_cuda",
sha256 = "f80438bee9906e9ecb1a8a4ae2365374ac1e8a283897281a2db2fb7fcf746333",
strip_prefix = "runtime-b1c7cce21ba4661c17ac72421c6a0e2015e7bef3/third_party/rules_cuda",
urls = ["https://github.com/tensorflow/runtime/archive/b1c7cce21ba4661c17ac72421c6a0e2015e7bef3.tar.gz"],
)
@ -29,7 +28,6 @@ http_archive(
name = "pybind11_bazel",
strip_prefix = "pybind11_bazel-992381ced716ae12122360b0fbadbc3dda436dbf",
urls = ["https://github.com/pybind/pybind11_bazel/archive/992381ced716ae12122360b0fbadbc3dda436dbf.zip"],
sha256 = "3dc6435bd41c058453efe102995ef084d0a86b0176fd6a67a6b7100a2e9a940e",
)
new_local_repository(
@ -52,7 +50,6 @@ http_archive(
urls = [
"https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
],
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
)
new_local_repository(