Skip to content
Closed
Changes from all commits
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
12 changes: 2 additions & 10 deletions validate-helm-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ if ! command -v helm &> /dev/null; then
exit 1
fi

# Store the initial working directory
INITIAL_DIR=$(pwd)
export INITIAL_DIR

# Set base directories to scan (erpc: base chart + prd env wrapper only)
DIRS_TO_SCAN=("helm/charts/erpc" "helm/environments/prd/erpc")

Expand Down Expand Up @@ -107,25 +103,21 @@ process_chart() {
# Build dependencies if Chart.yaml exists and has dependencies
if [ -f "${chart_absolute_path}/Chart.yaml" ]; then
if grep -q "dependencies:" "${chart_absolute_path}/Chart.yaml"; then
cd "$chart_absolute_path"
if ! helm dependency update > /dev/null 2>&1; then
if ! helm dependency update "$chart_absolute_path" > /dev/null 2>&1; then
echo -e "${RED}✗ Dependency update failed for ${chart_name}${NC}" >&2
cd "$INITIAL_DIR"
rm -f "$result_file" "$result_file.lint" "$result_file.template"
exit 1
fi
fi

# Run template validation
cd "$chart_absolute_path"
if ! helm template . 2>/dev/null | kubeconform --ignore-missing-schemas --summary --skip "$CUSTOM_RESOURCES" > "$result_file.template" 2>&1; then
if ! helm template "$chart_absolute_path" 2>/dev/null | kubeconform --ignore-missing-schemas --summary --skip "$CUSTOM_RESOURCES" > "$result_file.template" 2>&1; then
echo -e "${RED}✗ Kubeconform failed for ${chart_name}${NC}" >&2
cat "$result_file.template" >&2
has_error=1
else
echo -e "${GREEN}✓ Kubeconform passed for ${chart_name}${NC}" >&2
fi
cd "$INITIAL_DIR"
else
echo -e "${RED}No Chart.yaml found in ${chart_path}${NC}" >&2
has_error=1
Expand Down
Loading