Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
skip helm
Signed-off-by: alec-flowers <[email protected]>
  • Loading branch information
alec-flowers committed Nov 14, 2025
commit c38dac4dbfc8ec70dbe00d57c731dc75c15c2097
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ repos:
entry: python3 deploy/utils/validate_deployments.py
language: python
files: '(recipes|examples|tests|deploy)/.*\.(yaml|yml)$'
exclude: '(templates|chart)/.*\.(yaml|yml)$'
pass_filenames: true
additional_dependencies: [pyyaml, jsonschema]
26 changes: 22 additions & 4 deletions deploy/utils/validate_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def validate_file(self, yaml_file: Path) -> Tuple[bool, List[str]]:
dgd_docs = [
(i, doc)
for i, doc in enumerate(docs)
if doc and doc.get("kind") == "DynamoGraphDeployment"
if isinstance(doc, dict) and doc.get("kind") == "DynamoGraphDeployment"
]

if not dgd_docs:
Expand Down Expand Up @@ -259,10 +259,14 @@ def _format_path(self, path) -> str:

def has_dgd_resource(yaml_file: Path) -> bool:
"""Check if a YAML file contains DynamoGraphDeployment resources."""
# Skip Helm templates (contain {{ }} syntax)
if "/templates/" in str(yaml_file) or "/chart/" in str(yaml_file):
return False

try:
with open(yaml_file) as f:
for doc in yaml.safe_load_all(f):
if doc and doc.get("kind") == "DynamoGraphDeployment":
if isinstance(doc, dict) and doc.get("kind") == "DynamoGraphDeployment":
return True
return False
except Exception:
Expand All @@ -289,6 +293,9 @@ def find_deploy_files(root_dir: Path, limit_dirs: List[str] = None) -> List[Path
continue
for ext in ["*.yaml", "*.yml"]:
for yaml_file in search_dir.glob(f"**/{ext}"):
# Skip Helm template directories
if "/templates/" in str(yaml_file) or "/chart/" in str(yaml_file):
continue
if has_dgd_resource(yaml_file):
dgd_files.append(yaml_file)
return sorted(dgd_files)
Expand All @@ -304,7 +311,9 @@ def find_deploy_files(root_dir: Path, limit_dirs: List[str] = None) -> List[Path
timeout=10,
)
yaml_files = [
root_dir / Path(f) for f in result.stdout.strip().split("\n") if f
root_dir / Path(f)
for f in result.stdout.strip().split("\n")
if f and "/templates/" not in f and "/chart/" not in f
]
except (
subprocess.CalledProcessError,
Expand All @@ -313,7 +322,16 @@ def find_deploy_files(root_dir: Path, limit_dirs: List[str] = None) -> List[Path
):
# Fallback: search entire repo (excluding common directories)
yaml_files = []
exclude_dirs = {".git", "node_modules", "__pycache__", ".venv", "venv", ".tox"}
exclude_dirs = {
".git",
"node_modules",
"__pycache__",
".venv",
"venv",
".tox",
"templates",
"chart",
}
for ext in ["*.yaml", "*.yml"]:
for yaml_file in root_dir.glob(f"**/{ext}"):
if not any(part in exclude_dirs for part in yaml_file.parts):
Expand Down
Loading