rules_k8s icon indicating copy to clipboard operation
rules_k8s copied to clipboard

Bazel builds started failing due to checksum error

Open SGudbrandsson opened this issue 3 years ago • 10 comments

Bazel builds are now failing due to a failed checksum error. This started happening this morning.

https://github.com/bazelbuild/rules_k8s/blob/d05cbea5c56738ef02c667c10951294928a1d64a/k8s/k8s.bzl#L54

Anyone else experiencing this?

WARNING: Download from https://github.com/yaml/pyyaml/archive/5.1.2.zip failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was ba59d7e97eb131d8f8f52d19cb124bb67772f4c7f4d14cb2919deb885ef8c572 but wanted e9df8412ddabc9c21b4437ee138875b95ebb32c25f07f962439e16005152e00e
ERROR: An error occurred during the fetch of repository 'com_github_yaml_pyyaml':
   java.io.IOException: Error downloading [https://github.com/yaml/pyyaml/archive/5.1.2.zip] to /home/sigurdur/.cache/bazel/_bazel_sigurdur/71ecaec01697b935e8cbde2c3c9da6e5/external/com_github_yaml_pyyaml/5.1.2.zip: Checksum was ba59d7e97eb131d8f8f52d19cb124bb67772f4c7f4d14cb2919deb885ef8c572 but wanted e9df8412ddabc9c21b4437ee138875b95ebb32c25f07f962439e16005152e00e
ERROR: Evaluation of query "filter('\.apply', attr('tags', 'upload-assets', attr('tags', 'dev', allrdeps(set()))))" failed due to BUILD file errors

SGudbrandsson avatar Feb 01 '22 11:02 SGudbrandsson

Yup, same thing here

jarimayenburg avatar Feb 01 '22 14:02 jarimayenburg

Might be onto something here.

bazelbuild/rules_k8s uses the URL https://github.com/yaml/pyyaml/archive/5.1.2.zip, expecting checksum e9df8412ddabc9c21b4437ee138875b95ebb32c25f07f962439e16005152e00e while the file has checksum ba59d7e97eb131d8f8f52d19cb124bb67772f4c7f4d14cb2919deb885ef8c572

However, using URL https://github.com/yaml/pyyaml/archive/refs/tags/5.1.2.zip still yields checksum e9df8412ddabc9c21b4437ee138875b95ebb32c25f07f962439e16005152e00e.

The extracted files from both archives yield the same checksum, so I guess if we use URL https://github.com/yaml/pyyaml/archive/refs/tags/5.1.2.zip the problem should be fixed. Or we can change the checksum to ba59d7e97eb131d8f8f52d19cb124bb67772f4c7f4d14cb2919deb885ef8c572.

Also, shouldn't we use PyYAML 5.4 in this rule anyway? Since there's an approved PR for the requirements.txt upgrade (#676)

jarimayenburg avatar Feb 01 '22 15:02 jarimayenburg

Keep going back and forth on it but https://github.com/bazelbuild/rules_k8s/pull/683 updates the SHA for pyyaml

rajatvig avatar Feb 01 '22 15:02 rajatvig

Also seeing this issue, its failing most of our builds, we're using the following patch as (very temporary) mitigation:

From 383338ca3cb4b94deed34d18ff8237ab53cd28bf Mon Sep 17 00:00:00 2001
From: Luna Duclos <[email protected]>
Date: Tue, 1 Feb 2022 16:28:37 +0100
Subject: [PATCH] Use stable URL for pyyaml download

---
 k8s/k8s.bzl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git k8s/k8s.bzl k8s/k8s.bzl
index ad3268d..2fe510b 100644
--- k8s/k8s.bzl
+++ k8s/k8s.bzl
@@ -49,7 +49,7 @@ py_library(
 """,
             sha256 = "e9df8412ddabc9c21b4437ee138875b95ebb32c25f07f962439e16005152e00e",
             strip_prefix = "pyyaml-5.1.2",
-            urls = ["https://github.com/yaml/pyyaml/archive/5.1.2.zip"],
+            urls = ["https://github.com/yaml/pyyaml/archive/refs/tags/5.1.2.zip"],
         )
 
     # Register the default kubectl toolchain targets for supported platforms
-- 
2.30.0.windows.2


luna-duclos avatar Feb 01 '22 15:02 luna-duclos

Yes https://github.com/yaml/pyyaml/archive/5.1.2.zip is now redirecting to https://codeload.github.com/yaml/pyyaml/zip/5.1.2 and I believe the new hash is of the HTML page for the redirection:

<html><body>You are being <a href="https://codeload.github.com/yaml/pyyaml/zip/5.1.2">redirected</a>.</body></html>

marmeladema avatar Feb 01 '22 15:02 marmeladema

Yes https://github.com/yaml/pyyaml/archive/5.1.2.zip is now redirecting to https://codeload.github.com/yaml/pyyaml/zip/5.1.2 and I believe the new hash is of the HTML page for the redirection:

<html><body>You are being <a href="https://codeload.github.com/yaml/pyyaml/zip/5.1.2">redirected</a>.</body></html>

The hash for the archive is ba59d7e97eb131d8f8f52d19cb124bb67772f4c7f4d14cb2919deb885ef8c572 when the redirects are followed.

rajatvig avatar Feb 01 '22 15:02 rajatvig

This is possibly related: https://twitter.com/shs96c/status/1488480089700503558

bduffany avatar Feb 01 '22 18:02 bduffany

Locally this is now fixed for us.

brentleyjones avatar Feb 01 '22 19:02 brentleyjones

Seems that way. https://twitter.com/tgummerer/status/1488493440103030787?s=20&t=DaupVstH5BiSJd0BgLSa_Q suggests they applied a fix.

rajatvig avatar Feb 01 '22 22:02 rajatvig

Linking this to an upstream discussion: https://github.com/bazel-contrib/SIG-rules-authors/issues/11#issuecomment-1026769107

moriarty avatar Feb 02 '22 04:02 moriarty