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

chore(bazel): add MODULE.bazel files for bzlmod #1802

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,6 @@ $RECYCLE.BIN/

!gh-actions/**/dist
!gh-actions/github/mutex/lib

# Bazel
MODULE.bazel.lock
Copy link
Member

Choose a reason for hiding this comment

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

is the lockfile not checked in to repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because it isn't useful to share it as it is plateform dependant

Copy link
Member

Choose a reason for hiding this comment

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

hmm - i thought the utilitiy was that it contains the hashes (ie ensures you are downloading exactly the same file/s)

i seem to remember a similar issue with python lockfiles (which are generally checked in)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Even if the docs says it's better to persist it. You'll see many BCR maintainers discouraging it's persistance

Copy link
Member

Choose a reason for hiding this comment

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

yeah the docs seem to suggest this should be checked in afaict (https://bazel.build/external/lockfile#merge-conflicts)

i think we will need to do this - we cant just ensure trust/reproducibility from just versions

1 change: 1 addition & 0 deletions bazel/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
common --enable_bzlmod=0
27 changes: 27 additions & 0 deletions bazel/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module(name = "envoy_toolshed", version = "")

bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_pkg", version = "0.7.0")
bazel_dep(name = "rules_python", version = "0.31.0")
# -- bazel_dep definitions -- #

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib_toolchains.jq()
use_repo(bazel_lib_toolchains, "jq_toolchains")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.11")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip3",
python_version = "3.11",
requirements_lock = "//:requirements.txt",
)
pip.parse(
hub_name = "website_pip3",
python_version = "3.11",
requirements_lock = "//website:requirements.txt",
)
use_repo(pip, "pip3", "website_pip3")
Empty file added bazel/WORKSPACE.bzlmod
Empty file.