Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Running the target //tools:print_all_src_urls does no longer work #3293

Open
Ecklebe opened this issue Dec 2, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Ecklebe
Copy link

Ecklebe commented Dec 2, 2024

What happened?

Since the upgrade from aspect_rules_js version 1.42.3 to version 2.1.0 in the MODULE.bazel the bazel target //tools:print_all_src_urls does no longer work.

Version

Development (host) and target OS/architectures: WSL with Ubuntu 20.04.6 LTS

Output of bazel --version: bazel 7.4.1

Version of relevant rules from the WORKSPACE or MODULE.bazel file:
git commit hash: 9310d94

Language(s) and/or frameworks involved:

How to reproduce

mkdir bazel-central-registry-issue \
&& cd bazel-central-registry-issue \
&& git clone -q https://github.com/bazelbuild/bazel-central-registry.git . \
&& wget -q "https://github.com/bazelbuild/bazelisk/releases/download/v1.24.1/bazelisk-linux-amd64" \
&& chmod 777 ./bazelisk-linux-amd64 \
&& ./bazelisk-linux-amd64 --version \
&& export USE_BAZEL_VERSION=7.4.1 \
&& urls=($(./bazelisk-linux-amd64 run //tools:print_all_src_urls --registry=file://%workspace%)) \
&& echo $urls[0]

Error log:

ecklebe@W-8177:~$ mkdir bazel-central-registry-issue \
> && cd bazel-central-registry-issue \
> && git clone -q https://github.com/bazelbuild/bazel-central-registry.git . \
> && wget -q "https://github.com/bazelbuild/bazelisk/releases/download/v1.24.1/bazelisk-linux-amd64" \
> && chmod 777 ./bazelisk-linux-amd64 \
> && ./bazelisk-linux-amd64 --version \
> && export USE_BAZEL_VERSION=7.4.1 \
> && urls=($(./bazelisk-linux-amd64 run //tools:print_all_src_urls --registry=file://%workspace%)) \
> && echo $urls[0]
bazel 7.4.1
Starting local Bazel server and connecting to it...
Computing main repo mapping:
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: tools
Loading: 0 packages loaded
    currently loading: tools
Analyzing: target //tools:print_all_src_urls (1 packages loaded, 0 targets configured)
Analyzing: target //tools:print_all_src_urls (1 packages loaded, 0 targets configured)

WARNING: Download from https://github.com/bats-core/bats-core/archive/v1.10.0.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 401 Unauthorized
INFO: Repository aspect_bazel_lib~~toolchains~bats_toolchains instantiated at:
  <builtin>: in <toplevel>
Repository rule http_archive defined at:
  /home/ecklebe/.cache/bazel/_bazel_ecklebe/6024a2d64fca65da7150ed1ffb1e662d/external/bazel_tools/tools/build_defs/repo/http.bzl:387:31: in <toplevel>
ERROR: /home/ecklebe/.cache/bazel/_bazel_ecklebe/6024a2d64fca65da7150ed1ffb1e662d/external/bazel_tools/tools/build_defs/repo/http.bzl:136:45: An error occurred during the fetch of repository 'aspect_bazel_lib~~toolchains~bats_toolchains':
   Traceback (most recent call last):
        File "/home/ecklebe/.cache/bazel/_bazel_ecklebe/6024a2d64fca65da7150ed1ffb1e662d/external/bazel_tools/tools/build_defs/repo/http.bzl", line 136, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/bats-core/bats-core/archive/v1.10.0.tar.gz] to /home/ecklebe/.cache/bazel/_bazel_ecklebe/6024a2d64fca65da7150ed1ffb1e662d/external/aspect_bazel_lib~~toolchains~bats_toolchains/temp8389757105370932977/v1.10.0.tar.gz: GET returned 401 Unauthorized
Analyzing: target //tools:print_all_src_urls (91 packages loaded, 11 targets configured)

Analyzing: target //tools:print_all_src_urls (91 packages loaded, 11 targets configured)

ERROR: Analysis of target '//tools:print_all_src_urls' failed; build aborted: java.io.IOException: Error downloading [https://github.com/bats-core/bats-core/archive/v1.10.0.tar.gz] to /home/ecklebe/.cache/bazel/_bazel_ecklebe/6024a2d64fca65da7150ed1ffb1e662d/external/aspect_bazel_lib~~toolchains~bats_toolchains/temp8389757105370932977/v1.10.0.tar.gz: GET returned 401 Unauthorized
INFO: Elapsed time: 20.890s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
FAILED:
ERROR: Build failed. Not running target

Any other information?

Current workaround: Change the version back 1.42.3 in the MODULE.bazel file. Then the bazel target works again.

git diff MODULE.bazel
diff --git a/MODULE.bazel b/MODULE.bazel
index fca0721c..685aebcd 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -4,7 +4,7 @@ module(
     compatibility_level = 1,
 )

-bazel_dep(name = "aspect_rules_js", version = "2.1.0")
+bazel_dep(name = "aspect_rules_js", version = "1.42.3")
 bazel_dep(name = "buildozer", version = "7.1.2")
 bazel_dep(name = "rules_python", version = "0.40.0")
@Ecklebe Ecklebe added the bug Something isn't working label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant