Skip to content

Commit 954f637

Browse files
Add pre-commit hook for migration scripts
1 parent a7d5fa8 commit 954f637

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ repos:
9797
require_serial: true
9898
entry: tests/common/check-js.bash
9999

100+
- id: avoid-direct-cli-tools
101+
name: Avoid direct use of kubectl, helmfile, and helm in migrations (excluding comments, helpers, paths, logs, and strings)
102+
entry: >-
103+
(?m)^(?!\s*#)(?!.*log_(info|warn|error|fatal)\s+["']).*(?:^|\s)(?<!/)(kubectl(?![_a-zA-Z])|helmfile(?![_a-zA-Z])|helm(?![_a-zA-Z]))(?=\s|$)
104+
language: pygrep
105+
types: [text]
106+
files: '^migration/[^/]+/[^/]+/[^/]+\.sh$'
107+
100108
- repo: https://github.com/codespell-project/codespell
101109
rev: v2.3.0
102110
hooks:

migration/v0.46/apply/20-kube-prometheus-stack.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ if [[ -z "${CK8S_CLUSTER:-}" ]]; then
1212
log_fatal "CK8S_CLUSTER is not set. Please export CK8S_CLUSTER=wc|sc|both before running."
1313
fi
1414

15-
# Check if helmfile exists
16-
if ! command -v helmfile >/dev/null 2>&1; then
17-
log_fatal "helmfile is not installed. Please install it before running."
18-
fi
19-
2015
run() {
2116
case "${1:-}" in
2217
execute)

0 commit comments

Comments
 (0)