def lint_materialized_service(path: Path, service: Any, errors: List[LintError]) -> None: # command may be a string that is passed to the shell, or a list of # arguments. command = service.get("command", "") if isinstance(command, str): command = command.split( ) # split on whitespace to extract individual arguments if "--disable-telemetry" not in command: errors.append( LintError( path, "materialized service command does not include --disable-telemetry", ))
def lint_materialized_service(path: Path, name: str, service: Any, errors: List[LintError]) -> None: # command may be a string that is passed to the shell, or a list of # arguments. command = service.get("command", "") if isinstance(command, str): command = command.split( ) # split on whitespace to extract individual arguments if "--disable-telemetry" not in command: errors.append( LintError( path, "materialized service command does not include --disable-telemetry", )) env = service.get("environment", []) if "MZ_DEV=1" not in env: errors.append( LintError( path, f"materialized service '{name}' does not specify MZ_DEV=1 in its environment: {env}", ))
def lint_image_name(path: Path, spec: str, errors: List[LintError]) -> None: match = re.search(r"((?P<repo>[^/]+)/)?(?P<image>[^:]+)(:(?P<tag>.*))?", spec) if not match: errors.append( LintError(path, f"malformatted image specification: {spec}")) return (repo, image, tag) = (match.group("repo"), match.group("image"), match.group("tag")) if not tag: errors.append(LintError(path, f"image {spec} missing tag")) elif tag == "latest": errors.append( LintError(path, f'image {spec} depends on floating "latest" tag')) if repo == "confluentinc" and image.startswith("cp-"): if tag != LINT_CONFLUENT_PLATFORM_VERSION: errors.append( LintError( path, f"image {spec} depends on wrong version of Confluent Platform " f"(want {LINT_CONFLUENT_PLATFORM_VERSION})", )) if repo == "debezium": if tag != LINT_DEBEZIUM_VERSION: errors.append( LintError( path, f"image {spec} depends on wrong version of Debezium " f"(want {LINT_DEBEZIUM_VERSION})", )) if not repo and image == "zookeeper": errors.append( LintError( path, f"replace {spec} with official confluentinc/cp-zookeeper image" )) if repo == "wurstmeister" and image == "kafka": errors.append( LintError( path, f"replace {spec} with official confluentinc/cp-kafka image"))