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

Vendor mode does not include enough content to run a MODULE-based build without internet #22302

Open
peakschris opened this issue May 9, 2024 · 1 comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged

Comments

@peakschris
Copy link

peakschris commented May 9, 2024

Description of the bug:

Given a build with all internet repos defined in MODULE.bazel, running bazel vendor does not vendor enough content to subsequently run bazel without an internet connection.

/// Machine with internet access
<setup module-based build>
bazel vendor --vendor_dir=vendor
/// Machine without internet access
<setup module-based build>
bazel build --vendor_dir=vendor
<fails with errors about missing repos and missing bcr>

My closest (but still failing) attempt so far is:

/// Machine with internet access
<setup module-based build>
bazel vendor --vendor_dir=/offline/vendor
<prune unnecessary platforms from vendor dir>
bazel fetch @remotejdk_win/... --repository_cache=/offline/cache
cd src/build/offline/empty_workspace
bazel clean
bazel sync --repository_cache=/offline/cache
<download bazel-central-registry to /offline/bazel-central-registry>
/// Machine without internet access
bazel build //x --vendor_dir=/offline/vendor --repository_cache=/offline/cache --registry=file://offline/bazel-central-registry --nofetch
ERROR: Analysis of target '//x' failed; build aborted: to fix, run
        bazel fetch //...
External repository @@local_config_sh not found and fetching repositories is disabled.

Even if this worked, this is clunky, was hard to figure out, and the resulting set of directories is hard to manage across multiple build versions of our product. The ask is that all required internet content for a build that exclusively uses modules should be vendored by the vendor command.

I don't know if this is a bug or feature request, please assign as appropriate.

Which category does this issue belong to?

External Dependency

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

windows

What is the output of bazel info release?

release-7.2.0 latest (8c6220a)

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

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@github-actions github-actions bot added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label May 9, 2024
@peakschris
Copy link
Author

Update: Even the sequence of steps above fails, with this error. I'm stuck!

/// Machine without internet access
bazel build //x --vendor_dir=/offline/vendor --repository_cache=/offline/cache --registry=file://offline/bazel-central-registry --nofetch
ERROR: Analysis of target '//x' failed; build aborted: to fix, run
        bazel fetch //...
External repository @@local_config_sh not found and fetching repositories is disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged
Projects
None yet
Development

No branches or pull requests

4 participants