From 0a2fb5024c10f853e4cf9ab2ed197e27d78db5ed Mon Sep 17 00:00:00 2001 From: Ahir Reddy Date: Mon, 30 Jan 2023 17:50:49 -0800 Subject: [PATCH] Disable Checksum for Github.com --- .../bazel/repository/starlark/StarlarkRepositoryContext.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java index 147a1e3f04214a..32bfcb14f98f4d 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java @@ -1032,6 +1032,11 @@ private Checksum calculateChecksum(Optional originalChecksum, Path pat private Optional validateChecksum(String sha256, String integrity, List urls) throws RepositoryFunctionException, EvalException { + if (urls.size() == 1 && urls.get(0).getHost().contains("github.com")) { + // If the URL from Github and we don't have any other URLs from which to pull, we don't need + // to validate the checksum + return Optional.absent(); + } if (!sha256.isEmpty()) { if (!integrity.isEmpty()) { throw Starlark.errorf("Expected either 'sha256' or 'integrity', but not both");