Skip to content

Commit 72b4304

Browse files
authored
.bazelrc: recommend --lockfile_mode=error (#162)
* .bazelrc: recommend --lockfile_mode=error This should improve security posture for new rules and hopefully sets a good example for new Bazel projects in general. This flag is for regular builds, not when updating dependencies. It can't be used across Bazel versions either unfortunately. Signed-off-by: Jay Conrod <[email protected]> * make module extension reproducible and os- and arch-independent * upgrade gazelle to get reproducible go_deps, go_sdk --------- Signed-off-by: Jay Conrod <[email protected]>
1 parent 18ee45d commit 72b4304

File tree

4 files changed

+347
-1
lines changed

4 files changed

+347
-1
lines changed

.bazelrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ common --enable_bzlmod
1010
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0
1111
common --check_direct_dependencies=off
1212

13+
# Ensure that the MODULE.bazel.lock file is complete and committed.
14+
# This is an important security measure: it ensures that developers on the
15+
# same rule set download dependencies at the same versions with the same bits.
16+
# This setting does not affect modules that depend on this module.
17+
#
18+
# When updating dependencies, use --lockfile_mode=refresh, for example:
19+
# bazel mod tidy --lockfile_mode=refresh
20+
#
21+
# When testing different versions of Bazel, use --lockfile_mode=update or
22+
# --lockfile_mode=off. The lock file format changes over time, and different
23+
# versions of Bazel may expect different syntax. Bazel also implicitly requires
24+
# some modules, and different versions have different dependencies, which
25+
# also affects the contents of the lock file.
26+
common --lockfile_mode=error
27+
1328
# Load any settings specific to the current user.
1429
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
1530
# This needs to be last statement in this

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bazel_dep(name = "bazel_skylib", version = "1.4.1")
3434
bazel_dep(name = "package_metadata", version = "0.0.5")
3535
bazel_dep(name = "platforms", version = "0.0.5")
3636

37-
bazel_dep(name = "gazelle", version = "0.35.0", dev_dependency = True, repo_name = "bazel_gazelle")
37+
bazel_dep(name = "gazelle", version = "0.45.0", dev_dependency = True, repo_name = "bazel_gazelle")
3838
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
3939
bazel_dep(name = "bazel_lib", version = "3.0.0", dev_dependency = True)
4040
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2", dev_dependency = True)

0 commit comments

Comments
 (0)