|
15 | 15 | import os |
16 | 16 | import signal |
17 | 17 | import subprocess |
| 18 | +import threading |
18 | 19 | import time |
19 | 20 | from collections.abc import Sequence |
20 | 21 | from pathlib import Path |
@@ -140,24 +141,44 @@ def get_tag(tag: str | None) -> str: |
140 | 141 | return tag or f"v{ci_util.get_mz_version()}--pr.g{git.rev_parse('HEAD')}" |
141 | 142 |
|
142 | 143 |
|
143 | | -def mz_debug(env: dict[str, str] | None = None) -> None: |
| 144 | +def build_mz_debug_async(env: dict[str, str] | None = None) -> None: |
| 145 | + def run(): |
| 146 | + spawn.capture( |
| 147 | + [ |
| 148 | + "cargo", |
| 149 | + "build", |
| 150 | + "--bin", |
| 151 | + "mz-debug", |
| 152 | + ], |
| 153 | + cwd=MZ_ROOT, |
| 154 | + env=env, |
| 155 | + ) |
| 156 | + |
| 157 | + threading.Thread(target=run, daemon=True).start() |
| 158 | + |
| 159 | + |
| 160 | +def run_mz_debug(env: dict[str, str] | None = None) -> None: |
144 | 161 | print("-- Running mz-debug") |
145 | | - run_ignore_error( |
146 | | - [ |
147 | | - "cargo", |
148 | | - "run", |
149 | | - "--bin", |
150 | | - "mz-debug", |
151 | | - "--", |
152 | | - "self-managed", |
153 | | - "--k8s-namespace", |
154 | | - "materialize-environment", |
155 | | - "--k8s-namespace", |
156 | | - "materialize", |
157 | | - ], |
158 | | - cwd=MZ_ROOT, |
159 | | - env=env, |
160 | | - ) |
| 162 | + try: |
| 163 | + # mz-debug (and its compilation) is rather noisy, so ignore the output |
| 164 | + spawn.capture( |
| 165 | + [ |
| 166 | + "cargo", |
| 167 | + "run", |
| 168 | + "--bin", |
| 169 | + "mz-debug", |
| 170 | + "--", |
| 171 | + "self-managed", |
| 172 | + "--k8s-namespace", |
| 173 | + "materialize-environment", |
| 174 | + "--k8s-namespace", |
| 175 | + "materialize", |
| 176 | + ], |
| 177 | + cwd=MZ_ROOT, |
| 178 | + env=env, |
| 179 | + ) |
| 180 | + except: |
| 181 | + pass |
161 | 182 |
|
162 | 183 |
|
163 | 184 | class AWS: |
@@ -667,6 +688,7 @@ def workflow_aws_temporary(c: Composition, parser: WorkflowArgumentParser) -> No |
667 | 688 | path = MZ_ROOT / "test" / "terraform" / "aws-temporary" |
668 | 689 | aws = AWS(path) |
669 | 690 | try: |
| 691 | + build_mz_debug_async() |
670 | 692 | aws.setup("aws-test", args.setup, tag) |
671 | 693 | print("--- Running tests") |
672 | 694 | with c.override(testdrive(no_reset=False)): |
@@ -696,7 +718,7 @@ def workflow_aws_temporary(c: Composition, parser: WorkflowArgumentParser) -> No |
696 | 718 | finally: |
697 | 719 | aws.cleanup() |
698 | 720 |
|
699 | | - mz_debug() |
| 721 | + run_mz_debug() |
700 | 722 |
|
701 | 723 | if args.cleanup: |
702 | 724 | aws.destroy() |
@@ -736,6 +758,7 @@ def workflow_aws_upgrade(c: Composition, parser: WorkflowArgumentParser) -> None |
736 | 758 | path = MZ_ROOT / "test" / "terraform" / "aws-upgrade" |
737 | 759 | aws = AWS(path) |
738 | 760 | try: |
| 761 | + build_mz_debug_async() |
739 | 762 | aws.setup("aws-upgrade", args.setup, previous_tag) |
740 | 763 | aws.upgrade(tag) |
741 | 764 | # Try waiting a bit, otherwise connection error, should be handled better |
@@ -769,7 +792,7 @@ def workflow_aws_upgrade(c: Composition, parser: WorkflowArgumentParser) -> None |
769 | 792 | finally: |
770 | 793 | aws.cleanup() |
771 | 794 |
|
772 | | - mz_debug() |
| 795 | + run_mz_debug() |
773 | 796 |
|
774 | 797 | if args.cleanup: |
775 | 798 | aws.destroy() |
@@ -943,6 +966,7 @@ def workflow_gcp_temporary(c: Composition, parser: WorkflowArgumentParser) -> No |
943 | 966 | os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = str(gcloud_creds_path) |
944 | 967 |
|
945 | 968 | try: |
| 969 | + build_mz_debug_async() |
946 | 970 | spawn.runv(["gcloud", "config", "set", "project", "materialize-ci"]) |
947 | 971 |
|
948 | 972 | spawn.runv( |
@@ -1338,7 +1362,7 @@ def workflow_gcp_temporary(c: Composition, parser: WorkflowArgumentParser) -> No |
1338 | 1362 | if balancerd_port_forward_process: |
1339 | 1363 | os.killpg(os.getpgid(balancerd_port_forward_process.pid), signal.SIGTERM) |
1340 | 1364 |
|
1341 | | - mz_debug() |
| 1365 | + run_mz_debug() |
1342 | 1366 |
|
1343 | 1367 | if args.cleanup: |
1344 | 1368 | print("--- Cleaning up") |
@@ -1414,6 +1438,7 @@ def workflow_azure_temporary(c: Composition, parser: WorkflowArgumentParser) -> |
1414 | 1438 | ) |
1415 | 1439 |
|
1416 | 1440 | try: |
| 1441 | + build_mz_debug_async() |
1417 | 1442 | if os.getenv("CI"): |
1418 | 1443 | username = os.getenv("AZURE_SERVICE_ACCOUNT_USERNAME") |
1419 | 1444 | password = os.getenv("AZURE_SERVICE_ACCOUNT_PASSWORD") |
@@ -1837,7 +1862,7 @@ def workflow_azure_temporary(c: Composition, parser: WorkflowArgumentParser) -> |
1837 | 1862 | if balancerd_port_forward_process: |
1838 | 1863 | os.killpg(os.getpgid(balancerd_port_forward_process.pid), signal.SIGTERM) |
1839 | 1864 |
|
1840 | | - mz_debug(env=venv_env) |
| 1865 | + run_mz_debug(env=venv_env) |
1841 | 1866 |
|
1842 | 1867 | if args.cleanup: |
1843 | 1868 | print("--- Cleaning up") |
|
0 commit comments