File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 33 description : " Run Kubeconform on yaml files"
44 entry : ./kubeconform.sh
55 language : script
6+ files : \.(yaml|yml)$
Original file line number Diff line number Diff line change 1-
2-
31#! /bin/bash
42
53usage () { echo " Usage: ${0} [-p <string>]" ; exit 1; }
64
5+ check () {
6+ which kubeconform
7+ if [[ $? -gt 0 ]]; then
8+ echo " kubeconform not found, please install it from https://github.com/yannh/kubeconform/releases/latest"
9+ exit 255
10+ fi
11+ }
12+
13+ check
14+
715kpath=" "
816while getopts " p:" arg; do
917 case ${arg} in
@@ -20,13 +28,12 @@ shift $((OPTIND-1))
2028
2129for arg in " $@ "
2230do
23- if [[ $arg == * " .yaml " ]]; then
24- if [[ $path != " " ]] ; then
25- if [[ $arg != * " $path " * ]]; then
31+ if [[ $kpath != " " ]]; then
32+ echo ${arg} | grep -q ${kpath}
33+ if [[ $? -gt 0 ]]; then
2634 continue
2735 fi
2836 fi
2937 echo " Running kubeconform on $arg "
3038 kubeconform -strict -ignore-missing-schemas -summary -schema-location default -schema-location ' https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' $arg
31- fi
3239done
You can’t perform that action at this time.
0 commit comments