Skip to content

Commit cc8e22f

Browse files
committed
zippy: Support system params via CI_MZ_SYSTEM_PARAMETER_DEFAULT
1 parent e26a720 commit cc8e22f

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

misc/python/materialize/zippy/mz_actions.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# by the Apache License, Version 2.0.
99

1010

11+
import os
12+
1113
from materialize.mzcompose.composition import Composition
1214
from materialize.mzcompose.services.materialized import (
1315
LEADER_STATUS_HEALTHCHECK,
@@ -70,7 +72,19 @@ def __init__(
7072
capabilities: Capabilities,
7173
additional_system_parameter_defaults: dict[str, str] = {},
7274
) -> None:
73-
self.additional_system_parameter_defaults = additional_system_parameter_defaults
75+
if additional_system_parameter_defaults:
76+
self.additional_system_parameter_defaults = (
77+
additional_system_parameter_defaults
78+
)
79+
else:
80+
self.additional_system_parameter_defaults = {}
81+
for val in os.getenv("CI_MZ_SYSTEM_PARAMETER_DEFAULT", "").split(";"):
82+
x = val.split("=", maxsplit=1)
83+
assert (
84+
len(x) == 2
85+
), f"CI_MZ_SYSTEM_PARAMETER_DEFAULT '{val}' should be the format <key>=<val>"
86+
self.additional_system_parameter_defaults[x[0]] = x[1]
87+
7488
super().__init__(capabilities)
7589

7690
def run(self, c: Composition, state: State) -> None:

test/zippy/mzcompose.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
expected state it can verify results for correctness.
1414
"""
1515

16+
import os
1617
import random
1718
import re
1819
import time
@@ -177,14 +178,6 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
177178
help="Start Prometheus and Grafana",
178179
)
179180

180-
parser.add_argument(
181-
"--system-param",
182-
type=str,
183-
action="append",
184-
nargs="*",
185-
help="System parameters to set in Materialize, i.e. what you would set with `ALTER SYSTEM SET`",
186-
)
187-
188181
parser.add_argument(
189182
"--azurite", action="store_true", help="Use Azurite as blob store instead of S3"
190183
)
@@ -215,9 +208,11 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
215208
random.seed(args.seed)
216209

217210
additional_system_parameter_defaults = {}
218-
for val in args.system_param or []:
219-
x = val[0].split("=", maxsplit=1)
220-
assert len(x) == 2, f"--system-param '{val}' should be the format <key>=<val>"
211+
for val in os.getenv("CI_MZ_SYSTEM_PARAMETER_DEFAULT", "").split(";"):
212+
x = val.split("=", maxsplit=1)
213+
assert (
214+
len(x) == 2
215+
), f"CI_MZ_SYSTEM_PARAMETER_DEFAULT '{val}' should be the format <key>=<val>"
221216
additional_system_parameter_defaults[x[0]] = x[1]
222217

223218
with c.override(

0 commit comments

Comments
 (0)