bazel: Vendor mode does not show why an external repository is invalidated
Description of the bug:
Bazel vendor command produces a directory with dependencies.
However, it is impossible to build or run any targets on an airgapped system with the produced directory.
Bazel still requires access to network (or access to the cache that was in use while building vendor directory).
According to https://github.com/bazelbuild/bazel/issues/19563#issuecomment-2113515116, airgapped builds should be possible.
Which category does this issue belong to?
Core
What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Testing this in 7.3.0rc2:
$ bazel vendor //target
<Completes successfully, produces several gigabytes of dependencies in vendor directory, which will later be copied to an airgapped system>
$ bazel fetch //... # Is this needed? It does not seem to help.
... Disconnect from network or add --nofetch to .bazelrc ...
$ rm -rf <bazel local cache directory>
$ bazel test //target
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
ERROR: Error computing the main repository mapping: error during computation of main repo mapping: to fix, run
bazel fetch //...
External repository @@local_config_platform not found and fetching repositories is disabled.
Sometimes the error is:
External repository @@bazel_tools not found and fetching repositories is disabled.
Same happens when running bazel vendor without a particular target. Without removing local cache bazel test works fine on local system, but obviously will fail on an airgapped host.
Is there a setting I am missing?
It looks like bazel is having difficulty resolving approximately the following after cache is removed:
@local_config_platform//:all
@local_config_sh//:all
@@local_config_cc_toolchains//:all
@@local_jdk//:all
@@rules_java//:all
Running bazel vendor with each of the above does not help.
Which operating system are you running Bazel on?
any
What is the output of bazel info release?
release 7.3.0rc2
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 HEAD ?
No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
Instructions at https://bazel.build/run/build#running-bazel-airgapped do not resolve the problem.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 21 (8 by maintainers)
Commits related to this issue
- Explain why vendored repositories are considered out-of-date Work towards #23243 Closes #24857. PiperOrigin-RevId: 719146087 Change-Id: I03b1bfa4770fceca4c6eef1675094d39d7fee02e — committed to bazelbuild/bazel by fmeum 2 years ago
- [8.1.0] Explain why vendored repositories are considered out-of-date Work towards #23243 Closes #24857. PiperOrigin-RevId: 719146087 Change-Id: I03b1bfa4770fceca4c6eef1675094d39d7fee02e (cherry pi... — committed to fmeum/bazel by fmeum 2 years ago
- [8.1.0] Explain why vendored repositories are considered out-of-date (#25105) Work towards #23243 Closes #24857. PiperOrigin-RevId: 719146087 Change-Id: I03b1bfa4770fceca4c6eef1675094d39d7fee02e (... — committed to bazelbuild/bazel by fmeum 2 years ago
- Explain why vendored repositories are considered out-of-date Work towards #23243 Closes #24857. PiperOrigin-RevId: 719146087 Change-Id: I03b1bfa4770fceca4c6eef1675094d39d7fee02e — committed to fmeum/bazel by fmeum 2 years ago
I’m working on a PR that prints the reason for an outdated repo.
You are missing
--vendor_dirflag, without this flag, the vendor source won’t be used.