Skip to content

Commit 3f681c1

Browse files
committed
feat: improve e2e cacheability
Make sure changes to MODULE.bazel.lock and lock files don't invalidate the cache
1 parent c2b8ded commit 3f681c1

File tree

3 files changed

+68
-19
lines changed

3 files changed

+68
-19
lines changed

BUILD.bazel

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,9 @@ bzl_library(
108108
# local_path_override(path = "../..") can resolve the full module.
109109
filegroup(
110110
name = "local_repository_files",
111-
srcs = glob(
112-
[
113-
"*",
114-
".*",
115-
],
116-
exclude = [
117-
"MODULE.bazel.lock",
118-
"REPO.bazel",
119-
],
120-
) + [
111+
srcs = [
112+
"MODULE.bazel",
113+
"WORKSPACE",
121114
"//.aspect/bazelrc:all_files",
122115
"//bazeldnf:all_files",
123116
"//bazeldnf/private:all_files",

e2e/BUILD.bazel

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ load(
66
"default_test_runner",
77
"integration_test_utils",
88
)
9+
load("helpers.bzl", "glob_workspace_files")
910

1011
WORKSPACE_BAZEL_VERSIONS = [
1112
"6.5.0",
@@ -28,8 +29,12 @@ bazel_integration_tests(
2829
timeout = "long",
2930
bazel_binaries = bazel_binaries,
3031
bazel_versions = WORKSPACE_BAZEL_VERSIONS,
32+
tags = ["manual"],
3133
test_runner = ":test-runner",
32-
workspace_files = integration_test_utils.glob_workspace_files("bazel-workspace") + [
34+
workspace_files = glob_workspace_files(
35+
"bazel-workspace",
36+
extra_excludes = ["*/*.json"],
37+
) + [
3338
"//:local_repository_files",
3439
],
3540
workspace_path = "bazel-workspace",
@@ -41,8 +46,12 @@ bazel_integration_tests(
4146
timeout = "long",
4247
bazel_binaries = bazel_binaries,
4348
bazel_versions = BZLMOD_BAZEL_VERSIONS,
49+
tags = ["manual"],
4450
test_runner = ":test-runner",
45-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod") + [
51+
workspace_files = glob_workspace_files(
52+
"bazel-bzlmod",
53+
extra_excludes = ["*/*.json"],
54+
) + [
4655
"//:local_repository_files",
4756
],
4857
workspace_path = "bazel-bzlmod",
@@ -54,8 +63,9 @@ bazel_integration_tests(
5463
timeout = "long",
5564
bazel_binaries = bazel_binaries,
5665
bazel_versions = BZLMOD_BAZEL_VERSIONS,
66+
tags = ["manual"],
5767
test_runner = ":test-runner",
58-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-lock-file") + [
68+
workspace_files = glob_workspace_files("bazel-bzlmod-lock-file") + [
5969
"//:local_repository_files",
6070
],
6171
workspace_path = "bazel-bzlmod-lock-file",
@@ -67,8 +77,12 @@ bazel_integration_tests(
6777
timeout = "long",
6878
bazel_binaries = bazel_binaries,
6979
bazel_versions = BZLMOD_BAZEL_VERSIONS,
80+
tags = ["manual"],
7081
test_runner = ":test-runner",
71-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-toolchain-from-source") + [
82+
workspace_files = glob_workspace_files(
83+
"bazel-bzlmod-toolchain-from-source",
84+
extra_excludes = ["*/*.json"],
85+
) + [
7286
"//:local_repository_files",
7387
],
7488
workspace_path = "bazel-bzlmod-toolchain-from-source",
@@ -80,8 +94,12 @@ bazel_integration_tests(
8094
timeout = "long",
8195
bazel_binaries = bazel_binaries,
8296
bazel_versions = BZLMOD_BAZEL_VERSIONS,
97+
tags = ["manual"],
8398
test_runner = ":test-runner",
84-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-toolchain-from-source-lock-file") + [
99+
workspace_files = glob_workspace_files(
100+
"bazel-bzlmod-toolchain-from-source-lock-file",
101+
extra_excludes = ["*/*.json"],
102+
) + [
85103
"//:local_repository_files",
86104
],
87105
workspace_path = "bazel-bzlmod-toolchain-from-source-lock-file",
@@ -101,8 +119,9 @@ bazel_integration_tests(
101119
timeout = "long",
102120
bazel_binaries = bazel_binaries,
103121
bazel_versions = BZLMOD_BAZEL_VERSIONS,
122+
tags = ["manual"],
104123
test_runner = ":lock-file-from-args-runner",
105-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-lock-file-from-args") + [
124+
workspace_files = glob_workspace_files("bazel-bzlmod-lock-file-from-args") + [
106125
"//:local_repository_files",
107126
],
108127
workspace_path = "bazel-bzlmod-lock-file-from-args",
@@ -122,16 +141,23 @@ bazel_integration_tests(
122141
timeout = "long",
123142
bazel_binaries = bazel_binaries,
124143
bazel_versions = BZLMOD_BAZEL_VERSIONS,
125-
tags = ALLOWED_TO_FAIL_TAGS, # TODO: drop once the circular dependencies passes
144+
tags = [
145+
"allowed-to-fail", # TODO: drop once the circular dependencies passes
146+
"manual",
147+
],
126148
test_runner = ":test-runner_circular_deps",
127-
workspace_files = integration_test_utils.glob_workspace_files("bzlmod-toolchain-circular-dependencies") + [
149+
workspace_files = glob_workspace_files(
150+
"bzlmod-toolchain-circular-dependencies",
151+
extra_excludes = ["*/*.json"],
152+
) + [
128153
"//:local_repository_files",
129154
],
130155
workspace_path = "bzlmod-toolchain-circular-dependencies",
131156
)
132157

133158
test_suite(
134159
name = "workspace",
160+
tags = ["manual"],
135161
tests = integration_test_utils.bazel_integration_test_names(
136162
"e2e_workspace",
137163
WORKSPACE_BAZEL_VERSIONS,
@@ -140,6 +166,7 @@ test_suite(
140166

141167
test_suite(
142168
name = "bzlmod",
169+
tags = ["manual"],
143170
tests = integration_test_utils.bazel_integration_test_names(
144171
"e2e_bzlmod",
145172
BZLMOD_BAZEL_VERSIONS,
@@ -148,6 +175,7 @@ test_suite(
148175

149176
test_suite(
150177
name = "bzlmod-lock-file",
178+
tags = ["manual"],
151179
tests = integration_test_utils.bazel_integration_test_names(
152180
"e2e_bzlmod_lock_file",
153181
BZLMOD_BAZEL_VERSIONS,
@@ -156,6 +184,7 @@ test_suite(
156184

157185
test_suite(
158186
name = "bzlmod-toolchain-from-source",
187+
tags = ["manual"],
159188
tests = integration_test_utils.bazel_integration_test_names(
160189
"e2e_bzlmod_toolchain_from_source",
161190
BZLMOD_BAZEL_VERSIONS,
@@ -164,7 +193,10 @@ test_suite(
164193

165194
test_suite(
166195
name = "circular-deps",
167-
tags = ALLOWED_TO_FAIL_TAGS, # TODO: drop once the circular dependencies passes
196+
tags = [
197+
"allowed-to-fail", # TODO: drop once the circular dependencies passes
198+
"manual",
199+
],
168200
tests = integration_test_utils.bazel_integration_test_names(
169201
"e2e_circular_deps",
170202
BZLMOD_BAZEL_VERSIONS,
@@ -173,6 +205,7 @@ test_suite(
173205

174206
test_suite(
175207
name = "lock-file-from-args",
208+
tags = ["manual"],
176209
tests = integration_test_utils.bazel_integration_test_names(
177210
"e2e_lock_file_from_args",
178211
BZLMOD_BAZEL_VERSIONS,
@@ -181,6 +214,7 @@ test_suite(
181214

182215
test_suite(
183216
name = "e2e",
217+
tags = ["manual"],
184218
tests = [
185219
":workspace",
186220
":bzlmod",

e2e/helpers.bzl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"A series of helpers for our e2e infrastructure"
2+
3+
load("@bazel_skylib//lib:paths.bzl", "paths")
4+
5+
def glob_workspace_files(workspace_path, extra_excludes = []):
6+
"""Recursively globs the Bazel workspace files at the specified path.
7+
8+
Args:
9+
workspace_path: A `string` representing the path to glob.
10+
extra_excludes: Other glob patterns to ignore
11+
12+
Returns:
13+
A `list` of the files under the specified path ignoring certain Bazel
14+
artifacts (e.g. `bazel-*`).
15+
"""
16+
return native.glob(
17+
[paths.join(workspace_path, "**", "*")],
18+
exclude = [
19+
paths.join(workspace_path, "bazel-*", "**"),
20+
paths.join(workspace_path, "MODULE.bazel.lock"),
21+
] + extra_excludes,
22+
)

0 commit comments

Comments
 (0)