Skip to content

Commit 7d08525

Browse files
committed
ci: Fix cargo-test dependencies and test-certs upping
1 parent 2b0c4d6 commit 7d08525

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

ci/mkpipeline.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ def fetch_hashes() -> None:
196196
add_version_to_preflight_tests(pipeline)
197197
trim_builds_prep_thread.join()
198198
trim_builds(pipeline, hash_check)
199+
add_cargo_test_dependency(
200+
pipeline,
201+
args.pipeline,
202+
args.coverage,
203+
args.sanitizer,
204+
args.bazel_remote_cache,
205+
bazel_lto,
206+
)
199207
remove_dependencies_on_prs(pipeline, args.pipeline, hash_check)
200208
remove_mz_specific_keys(pipeline)
201209

@@ -856,6 +864,45 @@ def visit(step: PipelineStep) -> None:
856864
]
857865

858866

867+
def add_cargo_test_dependency(
868+
pipeline: Any,
869+
pipeline_name: str,
870+
coverage: bool,
871+
sanitizer: Sanitizer,
872+
bazel_remote_cache: str,
873+
bazel_lto: bool,
874+
) -> None:
875+
"""Cargo Test normally doesn't have to wait for the build to complete, but it requires a few images (ubuntu-base, postgres), which are rarely changed. So only add a dependency when those images are not on Dockerhub yet."""
876+
if pipeline_name not in ("test", "nightly"):
877+
return
878+
if ui.env_is_truthy("BUILDKITE_PULL_REQUEST") and pipeline_name == "test":
879+
for step in steps(pipeline):
880+
if step.get("id") == "cargo-test":
881+
step["depends_on"] = "build-x86_64"
882+
return
883+
884+
repo = mzbuild.Repository(
885+
Path("."),
886+
arch=Arch.X86_64,
887+
coverage=coverage,
888+
sanitizer=sanitizer,
889+
bazel=True,
890+
bazel_remote_cache=bazel_remote_cache,
891+
bazel_lto=bazel_lto,
892+
)
893+
composition = Composition(repo, name="cargo-test")
894+
deps = composition.dependencies
895+
if deps.check():
896+
# We already have the dependencies available, no need to add a build dependency
897+
return
898+
899+
for step in steps(pipeline):
900+
if step.get("id") == "cargo-test":
901+
step["depends_on"] = "build-x86_64"
902+
if step.get("id") == "miri-test":
903+
step["depends_on"] = "build-aarch64"
904+
905+
859906
def remove_dependencies_on_prs(
860907
pipeline: Any,
861908
pipeline_name: str,

misc/python/materialize/mysql_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def retrieve_ssl_context_for_mysql(c: Composition) -> MySqlSslContext:
4040

4141
def retrieve_invalid_ssl_context_for_mysql(c: Composition) -> MySqlSslContext:
4242
# Use the TestCert service to obtain a wrong CA and client cert/key:
43+
c.up({"name": "test-certs", "persistent": True})
4344
ssl_wrong_ca = c.run("test-certs", "cat", "/secrets/ca.crt", capture=True).stdout
4445
ssl_wrong_client_cert = c.run(
4546
"test-certs", "cat", "/secrets/certuser.crt", capture=True

test/pg-cdc-old-syntax/mzcompose.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def workflow_cdc(c: Composition, parser: WorkflowArgumentParser) -> None:
314314
)
315315
print(f"Files: {sharded_files}")
316316

317+
c.up({"name": "test-certs", "persistent": True})
317318
ssl_ca = c.run("test-certs", "cat", "/secrets/ca.crt", capture=True).stdout
318319
ssl_cert = c.run("test-certs", "cat", "/secrets/certuser.crt", capture=True).stdout
319320
ssl_key = c.run("test-certs", "cat", "/secrets/certuser.key", capture=True).stdout
@@ -396,6 +397,7 @@ def workflow_migration(c: Composition, parser: WorkflowArgumentParser) -> None:
396397
)
397398
print(f"Files: {sharded_files}")
398399

400+
c.up({"name": "test-certs", "persistent": True})
399401
ssl_ca = c.run("test-certs", "cat", "/secrets/ca.crt", capture=True).stdout
400402
ssl_cert = c.run("test-certs", "cat", "/secrets/certuser.crt", capture=True).stdout
401403
ssl_key = c.run("test-certs", "cat", "/secrets/certuser.key", capture=True).stdout

test/pg-cdc/mzcompose.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def workflow_cdc(c: Composition, parser: WorkflowArgumentParser) -> None:
300300
)
301301
print(f"Files: {sharded_files}")
302302

303+
c.up({"name": "test-certs", "persistent": True})
303304
ssl_ca = c.run("test-certs", "cat", "/secrets/ca.crt", capture=True).stdout
304305
ssl_cert = c.run("test-certs", "cat", "/secrets/certuser.crt", capture=True).stdout
305306
ssl_key = c.run("test-certs", "cat", "/secrets/certuser.key", capture=True).stdout

0 commit comments

Comments
 (0)