helm_template_common.sh 788 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. chart_path=library/common-test
  3. if [ ! $1 == "template" ]; then
  4. if [ $1 == "-f" ] && [ ! -z $2 ]; then
  5. extra_args=("-f" "$chart_path/ci/$2")
  6. fi
  7. fi
  8. function cleanup {
  9. if [ -d "$chart_path/charts" ]; then
  10. echo "🧹 Cleaning up charts..."
  11. rm -r "$chart_path/charts"
  12. rm "$chart_path/Chart.lock"
  13. fi
  14. }
  15. cleanup
  16. echo "Building common..."
  17. helm dependency update "$chart_path"
  18. if [ $1 == "template" ]; then
  19. echo "🧪 Running <helm template ./$chart_path"
  20. helm template -f "$chart_path/default-values.yaml" "./$chart_path" --debug
  21. else
  22. echo "🏁 Running <helm install --dry-run --debug common-test ${extra_args[@]} ./$chart_path"
  23. helm install --dry-run --debug common-test "${extra_args[@]}" "./$chart_path"
  24. fi
  25. helm lint "./$chart_path"
  26. cleanup