Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2364 Ensure release charts doesn't have pre-release dependencies #151

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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."