-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
81 lines (75 loc) · 2.52 KB
/
lefthook.yml
File metadata and controls
81 lines (75 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Lefthook configuration for Robusta K3s GitOps
# Runs validation and linting hooks locally before committing
pre-commit:
parallel: true
commands:
# Validate YAML syntax
yaml-lint:
glob: "*.{yml,yaml}"
run: >
yamllint -d "{extends: default, rules: {line-length: {max: 120}, document-start: disable}}" {staged_files}
skip:
- merge
- rebase
# Validate Kubernetes manifests
kubeconform:
glob: "*.{yml,yaml}"
exclude: ".teamcity|cliff.toml|lefthook.yml|mergify.yml"
run: |
if (Get-Command kubeconform -ErrorAction SilentlyContinue) {
kubeconform -strict -ignore-missing-schemas {staged_files}
} else {
Write-Host "⚠️ kubeconform not installed, skipping"
}
runner: powershell
skip:
- merge
- rebase
# Check for secrets
detect-secrets:
glob: "*.{yml,yaml}"
run: |
if (Get-Command ggshield -ErrorAction SilentlyContinue) {
ggshield secret scan pre-commit {staged_files}
} else {
Write-Host "⚠️ ggshield not installed, skipping"
}
runner: powershell
# Validate kustomize builds
kustomize-build:
glob: "**/kustomization.yaml"
run: |
if (Get-Command kustomize -ErrorAction SilentlyContinue) {
Get-ChildItem -Path overlays -Directory | ForEach-Object {
Write-Host "Building $($_.FullName)..."
kustomize build $_.FullName | Out-Null
if ($LASTEXITCODE -ne 0) { exit 1 }
}
Write-Host "✓ All kustomize overlays build successfully"
} else {
Write-Host "⚠️ kustomize not installed, skipping"
}
runner: powershell
pre-push:
parallel: false
commands:
# Run full validation before pushing
full-validation:
run: |
Write-Host "Running full validation..."
if (Test-Path .teamcity/settings.kts) {
Write-Host "✓ Pre-push validation passed"
}
runner: powershell
commit-msg:
commands:
# Ensure commit messages follow conventional commits
conventional-commit:
run: |
$commit_msg = Get-Content {1} -Raw
if ($commit_msg -notmatch "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?:\s.+") {
Write-Host "❌ Commit message must follow Conventional Commits format"
Write-Host "Examples: feat: add feature, fix: resolve bug, docs: update readme"
exit 1
}
runner: powershell