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

Add support for remote_files for http_archive #22155

Closed
wants to merge 18 commits into from

Conversation

fzakaria
Copy link
Contributor

@fzakaria fzakaria commented Apr 26, 2024

This issue adds support necessary to tackle
bazelbuild/bazel-central-registry#1566

Add two new attributes to http_archive: remote_file_urls and remote_file_integrity.

The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files.

This means we could probably deprecate build_file since that could be referenced as a file:// url in the remote_file_urls attribute.

Co-authored-by: Mark Williams markrwilliams@google.com

CC @fmeum

Copy link

google-cla bot commented Apr 26, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Apr 26, 2024
tools/build_defs/repo/utils.bzl Show resolved Hide resolved
src/test/shell/bazel/external_remote_file_test.sh Outdated Show resolved Hide resolved
@@ -139,6 +140,8 @@ def _http_archive_impl(ctx):
auth = get_auth(ctx, all_urls)

download_info = ctx.download_and_extract(
# TODO(fzakaria): all_urls here has the remote_patch URL which is incorrect
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fmeum I think this is a bug -- should I cut one?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, this seems wrong to me. This was likely an oversight in 445dfab, which just wanted to get this into get_auth.

CC @Wyverald

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed #22201 for tracking.

fzakaria and others added 5 commits April 30, 2024 21:03
This issue adds support necessary to tackle
bazelbuild/bazel-central-registry#1566

Add two new attributes to http_archive: remote_file_urls and
remote_file_integrity.

The purpose of these two attributes is to allow files to effectively be
overlaid ontop of an http_archive. The goal of such functionality would
be useful for BCR since the BUILD & WORKSPACE files need no longer be
stored as patch files.

This means we could probably deprecate `build_file` since that could be
referenced as a file:// url in the remote_file_urls attribute.

Co-authored-by: Mark Williams <markrwilliams@google.com>
* Added async download for remote_file for http-archive via block param
* Added validation to check that there is no relative paths present
@fzakaria fzakaria requested a review from fmeum May 1, 2024 18:06
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.

LGTM with minor comments

tools/build_defs/repo/utils.bzl Outdated Show resolved Hide resolved
tools/build_defs/repo/utils.bzl Outdated Show resolved Hide resolved
src/test/shell/bazel/external_remote_file_test.sh Outdated Show resolved Hide resolved
src/test/shell/bazel/external_remote_file_test.sh Outdated Show resolved Hide resolved
* Fixup comments
* Add test that verifies remote_files works with more than 1 segment
@fzakaria fzakaria requested a review from fmeum May 3, 2024 16:40
@fzakaria fzakaria requested a review from fmeum May 3, 2024 18:25
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.

@Wyverald Could you do the owner's review?

tools/build_defs/repo/http.bzl Outdated Show resolved Hide resolved
tools/build_defs/repo/http.bzl Outdated Show resolved Hide resolved
@fzakaria fzakaria requested a review from fmeum May 6, 2024 17:40
Copy link
Member

@Wyverald Wyverald left a comment

Choose a reason for hiding this comment

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

very nice! just a few docs nits.

tools/build_defs/repo/http.bzl Outdated Show resolved Hide resolved
tools/build_defs/repo/http.bzl Outdated Show resolved Hide resolved
tools/build_defs/repo/utils.bzl Outdated Show resolved Hide resolved
@fzakaria fzakaria requested a review from Wyverald May 6, 2024 21:34
@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels May 6, 2024
@fmeum
Copy link
Collaborator

fmeum commented May 7, 2024

@bazel-io fork 7.2.0

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label May 10, 2024
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request May 10, 2024
This issue adds support necessary to tackle
bazelbuild/bazel-central-registry#1566

Add two new attributes to http_archive: remote_file_urls and remote_file_integrity.

The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files.

This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute.

Co-authored-by: Mark Williams <markrwilliams@google.com>

CC @fmeum

Closes bazelbuild#22155.

PiperOrigin-RevId: 632594203
Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff
github-merge-queue bot pushed a commit that referenced this pull request May 10, 2024
This issue adds support necessary to tackle
bazelbuild/bazel-central-registry#1566

Add two new attributes to http_archive: remote_file_urls and
remote_file_integrity.

The purpose of these two attributes is to allow files to effectively be
overlaid ontop of an http_archive. The goal of such functionality would
be useful for BCR since the BUILD & WORKSPACE files need no longer be
stored as patch files.

This means we could probably deprecate `build_file` since that could be
referenced as a file:// url in the remote_file_urls attribute.

Co-authored-by: Mark Williams <markrwilliams@google.com>

CC @fmeum

Closes #22155.

PiperOrigin-RevId: 632594203
Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff

Commit
e01509f

Co-authored-by: Farid Zakaria <fmzakari@google.com>
Kila2 pushed a commit to Kila2/bazel that referenced this pull request May 13, 2024
This issue adds support necessary to tackle
bazelbuild/bazel-central-registry#1566

Add two new attributes to http_archive: remote_file_urls and remote_file_integrity.

The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files.

This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute.

Co-authored-by: Mark Williams <markrwilliams@google.com>

CC @fmeum

Closes bazelbuild#22155.

PiperOrigin-RevId: 632594203
Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff
fzakaria added a commit to fzakaria/bazel that referenced this pull request May 13, 2024
This is a continuation of bazelbuild#22155 that adds the newly added
'remote_files' attribute for http_archive to the bzlmod functionality.

The end goal is to then update BCR to this new functionality to overlay
files rather than use patch files when providing MODULE/WORKSPACE/BUILD
files.

bazelbuild/bazel-central-registry#1566 has a
good discussion of the rationale.
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants