Skip to content

Commit acc4d97

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

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
@@ -107,16 +107,9 @@ bzl_library(
107107
# local_path_override(path = "../..") can resolve the full module.
108108
filegroup(
109109
name = "local_repository_files",
110-
srcs = glob(
111-
[
112-
"*",
113-
".*",
114-
],
115-
exclude = [
116-
"MODULE.bazel.lock",
117-
"REPO.bazel",
118-
],
119-
) + [
110+
srcs = [
111+
"MODULE.bazel",
112+
"WORKSPACE",
120113
"//.aspect/bazelrc:all_files",
121114
"//bazeldnf:all_files",
122115
"//bazeldnf/private:all_files",

e2e/BUILD.bazel

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

910
WORKSPACE_BAZEL_VERSIONS = [
1011
"6.5.0",
@@ -27,8 +28,12 @@ bazel_integration_tests(
2728
timeout = "long",
2829
bazel_binaries = bazel_binaries,
2930
bazel_versions = WORKSPACE_BAZEL_VERSIONS,
31+
tags = ["manual"],
3032
test_runner = ":test-runner",
31-
workspace_files = integration_test_utils.glob_workspace_files("bazel-workspace") + [
33+
workspace_files = glob_workspace_files(
34+
"bazel-workspace",
35+
extra_excludes = ["*/*.json"],
36+
) + [
3237
"//:local_repository_files",
3338
],
3439
workspace_path = "bazel-workspace",
@@ -40,8 +45,12 @@ bazel_integration_tests(
4045
timeout = "long",
4146
bazel_binaries = bazel_binaries,
4247
bazel_versions = BZLMOD_BAZEL_VERSIONS,
48+
tags = ["manual"],
4349
test_runner = ":test-runner",
44-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod") + [
50+
workspace_files = glob_workspace_files(
51+
"bazel-bzlmod",
52+
extra_excludes = ["*/*.json"],
53+
) + [
4554
"//:local_repository_files",
4655
],
4756
workspace_path = "bazel-bzlmod",
@@ -53,8 +62,9 @@ bazel_integration_tests(
5362
timeout = "long",
5463
bazel_binaries = bazel_binaries,
5564
bazel_versions = BZLMOD_BAZEL_VERSIONS,
65+
tags = ["manual"],
5666
test_runner = ":test-runner",
57-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-lock-file") + [
67+
workspace_files = glob_workspace_files("bazel-bzlmod-lock-file") + [
5868
"//:local_repository_files",
5969
],
6070
workspace_path = "bazel-bzlmod-lock-file",
@@ -66,8 +76,12 @@ bazel_integration_tests(
6676
timeout = "long",
6777
bazel_binaries = bazel_binaries,
6878
bazel_versions = BZLMOD_BAZEL_VERSIONS,
79+
tags = ["manual"],
6980
test_runner = ":test-runner",
70-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-toolchain-from-source") + [
81+
workspace_files = glob_workspace_files(
82+
"bazel-bzlmod-toolchain-from-source",
83+
extra_excludes = ["*/*.json"],
84+
) + [
7185
"//:local_repository_files",
7286
],
7387
workspace_path = "bazel-bzlmod-toolchain-from-source",
@@ -79,8 +93,12 @@ bazel_integration_tests(
7993
timeout = "long",
8094
bazel_binaries = bazel_binaries,
8195
bazel_versions = BZLMOD_BAZEL_VERSIONS,
96+
tags = ["manual"],
8297
test_runner = ":test-runner",
83-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-toolchain-from-source-lock-file") + [
98+
workspace_files = glob_workspace_files(
99+
"bazel-bzlmod-toolchain-from-source-lock-file",
100+
extra_excludes = ["*/*.json"],
101+
) + [
84102
"//:local_repository_files",
85103
],
86104
workspace_path = "bazel-bzlmod-toolchain-from-source-lock-file",
@@ -100,8 +118,9 @@ bazel_integration_tests(
100118
timeout = "long",
101119
bazel_binaries = bazel_binaries,
102120
bazel_versions = BZLMOD_BAZEL_VERSIONS,
121+
tags = ["manual"],
103122
test_runner = ":lock-file-from-args-runner",
104-
workspace_files = integration_test_utils.glob_workspace_files("bazel-bzlmod-lock-file-from-args") + [
123+
workspace_files = glob_workspace_files("bazel-bzlmod-lock-file-from-args") + [
105124
"//:local_repository_files",
106125
],
107126
workspace_path = "bazel-bzlmod-lock-file-from-args",
@@ -121,16 +140,23 @@ bazel_integration_tests(
121140
timeout = "long",
122141
bazel_binaries = bazel_binaries,
123142
bazel_versions = BZLMOD_BAZEL_VERSIONS,
124-
tags = ALLOWED_TO_FAIL_TAGS, # TODO: drop once the circular dependencies passes
143+
tags = [
144+
"allowed-to-fail", # TODO: drop once the circular dependencies passes
145+
"manual",
146+
],
125147
test_runner = ":test-runner_circular_deps",
126-
workspace_files = integration_test_utils.glob_workspace_files("bzlmod-toolchain-circular-dependencies") + [
148+
workspace_files = glob_workspace_files(
149+
"bzlmod-toolchain-circular-dependencies",
150+
extra_excludes = ["*/*.json"],
151+
) + [
127152
"//:local_repository_files",
128153
],
129154
workspace_path = "bzlmod-toolchain-circular-dependencies",
130155
)
131156

132157
test_suite(
133158
name = "workspace",
159+
tags = ["manual"],
134160
tests = integration_test_utils.bazel_integration_test_names(
135161
"e2e_workspace",
136162
WORKSPACE_BAZEL_VERSIONS,
@@ -139,6 +165,7 @@ test_suite(
139165

140166
test_suite(
141167
name = "bzlmod",
168+
tags = ["manual"],
142169
tests = integration_test_utils.bazel_integration_test_names(
143170
"e2e_bzlmod",
144171
BZLMOD_BAZEL_VERSIONS,
@@ -147,6 +174,7 @@ test_suite(
147174

148175
test_suite(
149176
name = "bzlmod-lock-file",
177+
tags = ["manual"],
150178
tests = integration_test_utils.bazel_integration_test_names(
151179
"e2e_bzlmod_lock_file",
152180
BZLMOD_BAZEL_VERSIONS,
@@ -155,6 +183,7 @@ test_suite(
155183

156184
test_suite(
157185
name = "bzlmod-toolchain-from-source",
186+
tags = ["manual"],
158187
tests = integration_test_utils.bazel_integration_test_names(
159188
"e2e_bzlmod_toolchain_from_source",
160189
BZLMOD_BAZEL_VERSIONS,
@@ -163,7 +192,10 @@ test_suite(
163192

164193
test_suite(
165194
name = "circular-deps",
166-
tags = ALLOWED_TO_FAIL_TAGS, # TODO: drop once the circular dependencies passes
195+
tags = [
196+
"allowed-to-fail", # TODO: drop once the circular dependencies passes
197+
"manual",
198+
],
167199
tests = integration_test_utils.bazel_integration_test_names(
168200
"e2e_circular_deps",
169201
BZLMOD_BAZEL_VERSIONS,
@@ -172,6 +204,7 @@ test_suite(
172204

173205
test_suite(
174206
name = "lock-file-from-args",
207+
tags = ["manual"],
175208
tests = integration_test_utils.bazel_integration_test_names(
176209
"e2e_lock_file_from_args",
177210
BZLMOD_BAZEL_VERSIONS,
@@ -180,6 +213,7 @@ test_suite(
180213

181214
test_suite(
182215
name = "e2e",
216+
tags = ["manual"],
183217
tests = [
184218
":workspace",
185219
":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)