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

Maintain a separate lockfile for HEAD Bazel #21283

Closed
wants to merge 1 commit into from
Closed

Conversation

Wyverald
Copy link
Member

@Wyverald Wyverald commented Feb 9, 2024

The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit just checks in a lockfile for HEAD Bazel and removes that hack. This separate lockfile is updated by running bazel run //src/test/tools/bzlmod:update_default_lock_file. If it goes out of date, the distfile tests will complain.

The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit just checks in a lockfile for HEAD Bazel and removes that hack. This separate lockfile is updated by running `bazel run //src/test/tools/bzlmod:update_default_lock_file`. If it goes out of date, the distfile tests will complain.
@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Feb 9, 2024
@iancha1992 iancha1992 added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Feb 9, 2024
Copy link
Collaborator

@fmeum fmeum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Just so that we have considered it: couldn't we maintain MODULE.bazel.lock.dist as the output of a rule that consumes MODULE.bazel and runs bazel mod deps on it with Bazel built at HEAD? Then we wouldn't need to update it manually.

@Wyverald
Copy link
Member Author

Just so that we have considered it: couldn't we maintain MODULE.bazel.lock.dist as the output of a rule that consumes MODULE.bazel and runs bazel mod deps on it with Bazel built at HEAD? Then we wouldn't need to update it manually.

that was my first thought too, but the input to that rule is more than just MODULE.bazel -- it's also any .bzl files loaded, and any files they read, etc. I fiddled around with it a little bit before deciding that 1) it's too much work to figure out which files to include as input and 2) we already need to run the update_default_lock_file thing anyway.

@meteorcloudy
Copy link
Member

This change has the downside that any MODULE.bazel file change will require the developer to update the dist lock file, which requires running update_default_lock_file and building Bazel. Currently, only changing MODULE.tools or relevant bzl files will require the developer to run update_default_lock_file.

but the input to that rule is more than just MODULE.bazel -- it's also any .bzl files loaded, and any files they read, etc.

For the bootstrap build, we actually only need the Bazel module resolution to be updated to prevent accessing BCR, module extensions can just rerun. That's because 1) the maven repo is already overridden, 2) other required module extension generated repo already has repo cache in the distfile. Therefore, I think it's safe to generate the lockfile with a build rule without specifying all inputs.

Wyverald added a commit that referenced this pull request Feb 12, 2024
The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit generates a lockfile for HEAD Bazel on the fly and uses that for the distribution archive. This lockfile doesn't have any module extension content, since we only need to make sure that no network access happens during tests that use the distribution archive. See #21283 (comment) for more context.
@Wyverald
Copy link
Member Author

Thanks for the tip! Sent #21302 instead.

@Wyverald Wyverald closed this Feb 13, 2024
@Wyverald Wyverald deleted the wyv-distfile branch February 13, 2024 18:44
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Feb 13, 2024
copybara-service bot pushed a commit that referenced this pull request Feb 13, 2024
changes from PR #21302)

The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit generates a lockfile for HEAD Bazel on the fly and uses that for the distribution archive. This lockfile doesn't have any module extension content, since we only need to make sure that no network access happens during tests that use the distribution archive. See #21283 (comment) for more context.

Change-Id: I5266bd1caf2e4cc3d7d18cb8695af73488064ae1
Signed-off-by: Xudong Yang <[email protected]>
copybara-service bot pushed a commit that referenced this pull request Feb 13, 2024
The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit generates a lockfile for HEAD Bazel on the fly and uses that for the distribution archive. This lockfile doesn't have any module extension content, since we only need to make sure that no network access happens during tests that use the distribution archive. See #21283 (comment) for more context.

Closes #21302.

PiperOrigin-RevId: 606731749
Change-Id: If1f2b23066428b199e646059c76fa44ecfd2044a
Wyverald added a commit that referenced this pull request Feb 13, 2024
changes from PR #21302)

The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit generates a lockfile for HEAD Bazel on the fly and uses that for the distribution archive. This lockfile doesn't have any module extension content, since we only need to make sure that no network access happens during tests that use the distribution archive. See #21283 (comment) for more context.

Change-Id: I5266bd1caf2e4cc3d7d18cb8695af73488064ae1
Signed-off-by: Xudong Yang <[email protected]>
Wyverald added a commit that referenced this pull request Feb 13, 2024
The MODULE.bazel.lock file we have in our source tree is generated by the version of Bazel specified in the .bazelversion file. We currently use this lockfile for our distribution archives, which means whenever we increment the lockfile version, we need to manually transform the checked-in lockfile to make it work with HEAD Bazel too.

This commit generates a lockfile for HEAD Bazel on the fly and uses that for the distribution archive. This lockfile doesn't have any module extension content, since we only need to make sure that no network access happens during tests that use the distribution archive. See #21283 (comment) for more context.

Closes #21302.

PiperOrigin-RevId: 606731749
Change-Id: If1f2b23066428b199e646059c76fa44ecfd2044a
github-merge-queue bot pushed a commit that referenced this pull request Feb 14, 2024
…21338)

The MODULE.bazel.lock file we have in our source tree is generated by
the version of Bazel specified in the .bazelversion file. We currently
use this lockfile for our distribution archives, which means whenever we
increment the lockfile version, we need to manually transform the
checked-in lockfile to make it work with HEAD Bazel too.

This commit generates a lockfile for HEAD Bazel on the fly and uses that
for the distribution archive. This lockfile doesn't have any module
extension content, since we only need to make sure that no network
access happens during tests that use the distribution archive. See
#21283 (comment)
for more context.

Closes #21302.

---------

Signed-off-by: Xudong Yang <[email protected]>
fzakaria added a commit to fzakaria/bazel that referenced this pull request Apr 27, 2024
Mark found out via bazelbuild#21283 that we should run the command
`bazel run //src/test/tools/bzlmod:update_default_lock_file`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants