Skip to content

Commit 64d9d6f

Browse files
authored
fix: correctly advertise minimum supported version (bazel-contrib#1065)
* feat: bump the latest supported version to 5.4.0 * feat: add gazelle and RBE minimum supported version tests * feat: pip_parse_vendored example is now 5.4.0 compatible
1 parent 2893d85 commit 64d9d6f

File tree

7 files changed

+115
-3
lines changed

7 files changed

+115
-3
lines changed

.bazelci/presubmit.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ buildifier:
1717
version: latest
1818
# keep this argument in sync with .pre-commit-config.yaml
1919
warnings: "all"
20+
.minimum_supported_version: &minimum_supported_version
21+
# For testing minimum supported version.
22+
# NOTE: Keep in sync with //:version.bzl
23+
bazel: 5.4.0
24+
.minimum_supported_bzlmod_version: &minimum_supported_bzlmod_version
25+
bazel: 6.0.0 # test minimum supported version of bazel for bzlmod tests
2026
.reusable_config: &reusable_config
2127
build_targets:
2228
- "--"
@@ -54,12 +60,24 @@ buildifier:
5460
- //tests:version_3_9_test
5561
- //tests:version_default_test
5662
tasks:
63+
gazelle_extension_min:
64+
<<: *minimum_supported_version
65+
name: Test the Gazelle extension using minimum supported Bazel version
66+
platform: ubuntu2004
67+
build_targets: ["//..."]
68+
test_targets: ["//..."]
69+
working_directory: gazelle
5770
gazelle_extension:
5871
name: Test the Gazelle extension
5972
platform: ubuntu2004
6073
build_targets: ["//..."]
6174
test_targets: ["//..."]
6275
working_directory: gazelle
76+
ubuntu_min:
77+
<<: *minimum_supported_version
78+
<<: *reusable_config
79+
name: Default test on Ubuntu using minimum supported Bazel version
80+
platform: ubuntu2004
6381
ubuntu:
6482
<<: *reusable_config
6583
name: Default test on Ubuntu
@@ -78,13 +96,27 @@ tasks:
7896
platform: windows
7997
test_flags:
8098
- "--test_tag_filters=-integration-test,-fix-windows"
99+
100+
rbe_min:
101+
<<: *minimum_supported_version
102+
<<: *reusable_config
103+
name: Test on RBE using minimum supported Bazel version
104+
platform: rbe_ubuntu1604
105+
test_flags:
106+
- "--test_tag_filters=-integration-test,-acceptance-test"
81107
rbe:
82108
<<: *reusable_config
83109
name: Test on RBE
84110
platform: rbe_ubuntu1604
85111
test_flags:
86112
- "--test_tag_filters=-integration-test,-acceptance-test"
87113

114+
integration_test_build_file_generation_ubuntu_minimum_supported:
115+
<<: *minimum_supported_version
116+
<<: *reusable_build_test_all
117+
name: build_file_generation integration tests on Ubuntu using minimum supported Bazel version
118+
working_directory: examples/build_file_generation
119+
platform: ubuntu2004
88120
integration_test_build_file_generation_ubuntu:
89121
<<: *reusable_build_test_all
90122
name: build_file_generation integration tests on Ubuntu
@@ -106,6 +138,13 @@ tasks:
106138
working_directory: examples/build_file_generation
107139
platform: windows
108140

141+
integration_test_bzlmod_ubuntu_min:
142+
<<: *minimum_supported_bzlmod_version
143+
<<: *reusable_build_test_all
144+
<<: *coverage_targets_example_bzlmod
145+
name: bzlmod integration tests on Ubuntu using minimum supported Bazel version
146+
working_directory: examples/bzlmod
147+
platform: ubuntu2004
109148
integration_test_bzlmod_ubuntu:
110149
<<: *reusable_build_test_all
111150
<<: *coverage_targets_example_bzlmod
@@ -131,6 +170,12 @@ tasks:
131170
working_directory: examples/bzlmod
132171
platform: windows
133172

173+
integration_test_multi_python_versions_ubuntu_min:
174+
<<: *minimum_supported_version
175+
<<: *reusable_build_test_all
176+
name: multi_python_versions integration tests on Ubuntu using minimum supported Bazel version
177+
working_directory: examples/multi_python_versions
178+
platform: ubuntu2004
134179
integration_test_multi_python_versions_ubuntu:
135180
<<: *reusable_build_test_all
136181
<<: *coverage_targets_example_multi_python
@@ -156,6 +201,12 @@ tasks:
156201
working_directory: examples/multi_python_versions
157202
platform: windows
158203

204+
integration_test_pip_install_ubuntu_min:
205+
<<: *minimum_supported_version
206+
<<: *reusable_build_test_all
207+
name: pip_install integration tests on Ubuntu using minimum supported Bazel version
208+
working_directory: examples/pip_install
209+
platform: ubuntu2004
159210
integration_test_pip_install_ubuntu:
160211
<<: *reusable_build_test_all
161212
name: pip_install integration tests on Ubuntu
@@ -177,6 +228,12 @@ tasks:
177228
working_directory: examples/pip_install
178229
platform: windows
179230

231+
integration_test_pip_parse_ubuntu_min:
232+
<<: *minimum_supported_version
233+
<<: *reusable_build_test_all
234+
name: pip_parse integration tests on Ubuntu using minimum supported Bazel version
235+
working_directory: examples/pip_parse
236+
platform: ubuntu2004
180237
integration_test_pip_parse_ubuntu:
181238
<<: *reusable_build_test_all
182239
name: pip_parse integration tests on Ubuntu
@@ -198,6 +255,12 @@ tasks:
198255
working_directory: examples/pip_parse
199256
platform: windows
200257

258+
integration_test_pip_parse_vendored_ubuntu_min:
259+
<<: *minimum_supported_version
260+
<<: *reusable_build_test_all
261+
name: pip_parse_vendored integration tests on Ubuntu using minimum supported Bazel version
262+
working_directory: examples/pip_parse_vendored
263+
platform: ubuntu2004
201264
integration_test_pip_parse_vendored_ubuntu:
202265
<<: *reusable_build_test_all
203266
name: pip_parse_vendored integration tests on Ubuntu
@@ -216,6 +279,12 @@ tasks:
216279
# We don't run pip_parse_vendored under Windows as the file checked in is
217280
# generated from a repository rule containing OS-specific rendered paths.
218281

282+
integration_test_py_proto_library_ubuntu_min:
283+
<<: *minimum_supported_version
284+
<<: *reusable_build_test_all
285+
name: py_proto_library integration tests on Ubuntu using minimum supported Bazel version
286+
working_directory: examples/py_proto_library
287+
platform: ubuntu2004
219288
integration_test_py_proto_library_ubuntu:
220289
<<: *reusable_build_test_all
221290
name: py_proto_library integration tests on Ubuntu
@@ -238,6 +307,13 @@ tasks:
238307
platform: windows
239308

240309
# Check the same using bzlmod as well
310+
integration_test_py_proto_library_bzlmod_ubuntu_min:
311+
<<: *minimum_supported_bzlmod_version
312+
<<: *common_bzlmod_flags
313+
<<: *reusable_build_test_all
314+
name: py_proto_library bzlmod integration tests on Ubuntu using minimum supported Bazel version
315+
working_directory: examples/py_proto_library
316+
platform: ubuntu2004
241317
integration_test_py_proto_library_bzlmod_ubuntu:
242318
<<: *reusable_build_test_all
243319
<<: *common_bzlmod_flags
@@ -263,6 +339,12 @@ tasks:
263339
working_directory: examples/py_proto_library
264340
platform: windows
265341

342+
integration_test_pip_repository_annotations_ubuntu_min:
343+
<<: *minimum_supported_version
344+
<<: *reusable_build_test_all
345+
name: pip_repository_annotations integration tests on Ubuntu using minimum supported Bazel version
346+
working_directory: examples/pip_repository_annotations
347+
platform: ubuntu2004
266348
integration_test_pip_repository_annotations_ubuntu:
267349
<<: *reusable_build_test_all
268350
name: pip_repository_annotations integration tests on Ubuntu
@@ -284,6 +366,12 @@ tasks:
284366
working_directory: examples/pip_repository_annotations
285367
platform: windows
286368

369+
integration_test_compile_pip_requirements_ubuntu_min:
370+
<<: *minimum_supported_version
371+
<<: *reusable_build_test_all
372+
name: compile_pip_requirements integration tests on Ubuntu using minimum supported Bazel version
373+
working_directory: tests/compile_pip_requirements
374+
platform: ubuntu2004
287375
integration_test_compile_pip_requirements_ubuntu:
288376
<<: *reusable_build_test_all
289377
name: compile_pip_requirements integration tests on Ubuntu
@@ -333,6 +421,12 @@ tasks:
333421
- "bazel run //:requirements.update"
334422
- "git diff --exit-code"
335423

424+
integration_test_pip_repository_entry_points_ubuntu_min:
425+
<<: *minimum_supported_version
426+
<<: *reusable_build_test_all
427+
name: pip_repository_entry_points integration tests on Ubuntu using minimum supported Bazel version
428+
working_directory: tests/pip_repository_entry_points
429+
platform: ubuntu2004
336430
integration_test_pip_repository_entry_points_ubuntu:
337431
<<: *reusable_build_test_all
338432
name: pip_repository_entry_points integration tests on Ubuntu
@@ -354,6 +448,12 @@ tasks:
354448
working_directory: tests/pip_repository_entry_points
355449
platform: windows
356450

451+
integration_test_ignore_root_user_error_ubuntu_min:
452+
<<: *minimum_supported_version
453+
<<: *reusable_build_test_all
454+
name: ignore_root_user_error integration tests on Ubuntu using minimum supported Bazel version
455+
working_directory: tests/ignore_root_user_error
456+
platform: ubuntu2004
357457
integration_test_ignore_root_user_error_ubuntu:
358458
<<: *reusable_build_test_all
359459
name: ignore_root_user_error integration tests on Ubuntu

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ filegroup(
3131
"WORKSPACE",
3232
"internal_deps.bzl",
3333
"internal_setup.bzl",
34+
"version.bzl",
3435
"//python:distribution",
3536
"//python/pip_install:distribution",
3637
"//tools:distribution",

docs/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ bzl_library(
6767
],
6868
deps = [
6969
":defs",
70+
"//:version.bzl",
7071
],
7172
)
7273

examples/pip_parse_vendored/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ genrule(
1717
"cat $<",
1818
# Insert our load statement after the existing one so we don't produce a file with buildifier warnings
1919
"""sed -e '/^load.*/i\\'$$'\\n''load("@python39//:defs.bzl", "interpreter")'""",
20+
# Replace the bazel 6.0.0 specific comment with something that bazel 5.4.0 would produce.
21+
# This enables this example to be run as a test under bazel 5.4.0.
22+
"""sed -e 's#@//#//#'""",
2023
"""tr "'" '"' """,
2124
"""sed 's#"@python39_.*//:bin/python3"#interpreter#' >$@""",
2225
]),

examples/pip_parse_vendored/requirements.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Starlark representation of locked requirements.
22
33
@generated by rules_python pip_parse repository rule
4-
from @//:requirements.txt
4+
from //:requirements.txt
55
"""
66

77
load("@python39//:defs.bzl", "interpreter")

python/pip_install/repositories.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
load("@bazel_skylib//lib:versions.bzl", "versions")
1818
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1919
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
20+
load("//:version.bzl", "MINIMUM_BAZEL_VERSION")
2021

2122
_RULE_DEPS = [
2223
(
@@ -133,7 +134,7 @@ def pip_install_dependencies():
133134
# Give the user an obvious error to upgrade rather than some obscure missing symbol later.
134135
# It's not guaranteed that users call this function, but it's used by all the pip fetch
135136
# repository rules so it's likely that most users get the right error.
136-
versions.check("4.0.0")
137+
versions.check(MINIMUM_BAZEL_VERSION)
137138

138139
for (name, url, sha256) in _RULE_DEPS:
139140
maybe(

version.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@
1919
# in .bazelversion.
2020
BAZEL_VERSION = "6.0.0"
2121

22+
# NOTE: Keep in sync with .bazelci/presubmit.yml
23+
# This is the minimum supported bazel version, that we have some tests for.
24+
MINIMUM_BAZEL_VERSION = "5.4.0"
25+
2226
# Versions of Bazel which users should be able to use.
2327
# Ensures we don't break backwards-compatibility,
2428
# accidentally forcing users to update their LTS-supported bazel.
2529
# These are the versions used when testing nested workspaces with
2630
# bazel_integration_test.
2731
SUPPORTED_BAZEL_VERSIONS = [
28-
# TODO: add LTS versions of bazel like 1.0.0, 2.0.0
2932
BAZEL_VERSION,
33+
# TODO @aignas 2023-02-15: the integration tests currently support
34+
# only a single element in this array.
35+
#MINIMUM_BAZEL_VERSION,
3036
]
3137

3238
def bazel_version_to_binary_label(version):

0 commit comments

Comments
 (0)