-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
44 lines (39 loc) · 1.48 KB
/
Copy pathlefthook.yml
File metadata and controls
44 lines (39 loc) · 1.48 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
# Lefthook configuration: https://lefthook.dev/configuration/
#
# Hooks lint Helm charts and YAML files locally before they reach CI.
# Required tools (auto-checked):
# - helm (https://helm.sh)
# - yamllint (pip install yamllint / brew install yamllint)
# - kubeconform (https://github.com/yannh/kubeconform) — optional, for K8s manifests
pre-commit:
parallel: true
jobs:
- name: yamllint
glob: "*.{yaml,yml}"
run: yamllint -c .yamllint.yaml {staged_files}
- name: helm-lint
glob: "charts/*/Chart.yaml"
run: |
for f in {staged_files}; do
chart_dir="$(dirname "$f")"
echo ">>> helm lint $chart_dir"
helm lint "$chart_dir"
done
- name: helm-template
glob: "charts/**/*.{yaml,yml,tpl}"
run: |
# Re-template each chart whose files changed; catches Sprig/template errors.
charts="$(printf '%s\n' {staged_files} | awk -F/ '/^charts\//{print $1"/"$2}' | sort -u)"
for c in $charts; do
echo ">>> helm template $c"
helm template "$c" >/dev/null
done
- name: helmfile-lint
glob: "{helmfile.yaml,deploy/fleet/values-*.yaml}"
run: helmfile lint
commit-msg:
jobs:
- name: conventional-commit
run: |
head -1 {1} | grep -Eq '^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?: .+' \
|| { echo "Commit message must follow Conventional Commits (feat:, fix:, chore:, ...)" >&2; exit 1; }