Skip to content

Commit

Permalink
OPSEXP-2364 Ensure release charts doesn't have pre-release dependenci…
Browse files Browse the repository at this point in the history
…es (#151)
gionn authored Nov 8, 2023
1 parent f2f084c commit 6b45137
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@ repos:
files: charts/.*\.yaml$
verbose: true
args:
- --quiet
- --compact
- --quiet
- --compact
- repo: https://github.com/jtyr/kubeconform-helm
rev: v0.1.15
hooks:
@@ -40,3 +40,9 @@ repos:
args:
- --exclude-charts=alfresco-common,alfresco-sync-service
- --values-dir=ci
- repo: local
hooks:
- id: custom-check-chart-versions
name: Check Chart dependencies
entry: ./scripts/charts.sh
language: script
16 changes: 16 additions & 0 deletions scripts/charts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash -e

for chart_file in charts/*/Chart.yaml; do
chart_version=$(yq eval '.version' "$chart_file") # Assuming you have yq installed
if [[ "$chart_version" == *-* ]]; then
continue
fi

dependencies=$(yq eval '.dependencies[] | select(.version | test("-"))' "$chart_file")
if [ -n "$dependencies" ]; then
echo "Chart $chart_file has dependencies with a pre-release version, but the main chart version doesn't."
exit 1
fi
done

echo "All charts passed the check."

0 comments on commit 6b45137

Please sign in to comment.