Skip to content
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
75 changes: 75 additions & 0 deletions .github/workflows/helm-chart-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Helm Chart Tests

on:
pull_request:
paths:
- 'charts/**'
workflow_dispatch:

jobs:
validate-charts:
name: Validate Helm Charts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.12.0

- name: Add Bitnami repository
run: helm repo add bitnami https://charts.bitnami.com/bitnami

- name: Update Helm repositories
run: helm repo update

- name: Build dependencies
run: |
cd charts/metaflow
helm dependency build
helm dependency update

- name: Lint charts
run: |
cd charts/metaflow
helm lint .

cd charts/metaflow-service
helm lint .

cd ../metaflow-ui
helm lint .

- name: Test template rendering
run: |
cd charts/metaflow

# Test with default values
helm template test-default . > /dev/null

# Test with all components enabled
helm template test-full . \
--set postgresql.enabled=true \
--set metaflow-service.enabled=true \
--set metaflow-ui.enabled=true > /dev/null

# Test with selective components
helm template test-selective . \
--set postgresql.enabled=true \
--set metaflow-service.enabled=true \
--set metaflow-ui.enabled=false > /dev/null

- name: Bug detection
run: |
cd charts/metaflow

# Check for the metadatadb password bug
TEMPLATE_OUTPUT=$(helm template test-bug . --set metaflow-ui.enabled=true)
if echo "$TEMPLATE_OUTPUT" | grep -q "\.Values\.metadatadb\.password"; then
echo "ERROR: Found bug in metaflow-ui helpers - using .Values.metadatadb.password instead of .Values.uiBackend.metadatadb.password"
exit 1
fi

echo "✓ Bug detection passed"
4 changes: 2 additions & 2 deletions charts/metaflow/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
version: 0.2.2
condition: metaflow-service.enabled
- name: metaflow-ui
version: 0.3.1
version: 0.3.2
condition: metaflow-ui.enabled
- name: postgresql
repository: https://charts.bitnami.com/bitnami
Expand All @@ -23,4 +23,4 @@ sources:
- https://github.com/Netflix/metaflow
- https://github.com/outerbounds/metaflow-tools
type: application
version: 0.1.1
version: 0.1.2
2 changes: 1 addition & 1 deletion charts/metaflow/charts/metaflow-ui/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: v2.4.13
description: A Helm chart to deploy Metaflow UI components.
name: metaflow-ui
type: application
version: 0.3.1
version: 0.3.2
maintainers:
- name: Savin Goyal
email: savin@outerbounds.co
Expand Down
117 changes: 117 additions & 0 deletions charts/metaflow/test-charts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/bash

set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Function to print colored output
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}

print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}

print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}

# Check if Helm is installed
if ! command -v helm &> /dev/null; then
print_error "Helm is not installed. Please install Helm first."
exit 1
fi

print_status "Starting Helm chart validation..."

# Change to the metaflow chart directory
cd "$(dirname "$0")"

# Add required repositories
print_status "Adding Helm repositories..."
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

# Build dependencies
print_status "Building chart dependencies..."
helm dependency build
helm dependency update

# Lint the main chart
print_status "Linting main chart..."
if helm lint .; then
print_status "Main chart linting passed"
else
print_error "Main chart linting failed"
exit 1
fi

# Lint subcharts
print_status "Linting subcharts..."
for subchart in charts/metaflow-service charts/metaflow-ui; do
if [ -d "$subchart" ]; then
print_status "Linting $subchart..."
if helm lint "$subchart"; then
print_status "$subchart linting passed"
else
print_error "$subchart linting failed"
exit 1
fi
fi
done

# Test template rendering with different configurations
print_status "Testing template rendering..."

# Test 1: Default values
print_status "Testing with default values..."
if helm template test-default . > /dev/null; then
print_status "Default values template rendering passed"
else
print_error "Default values template rendering failed"
exit 1
fi

# Test 2: All components enabled
print_status "Testing with all components enabled..."
if helm template test-full . \
--set postgresql.enabled=true \
--set metaflow-service.enabled=true \
--set metaflow-ui.enabled=true > /dev/null; then
print_status "All components template rendering passed"
else
print_error "All components template rendering failed"
exit 1
fi

# Test 3: Selective components
print_status "Testing with selective components..."
if helm template test-selective . \
--set postgresql.enabled=true \
--set metaflow-service.enabled=true \
--set metaflow-ui.enabled=false > /dev/null; then
print_status "Selective components template rendering passed"
else
print_error "Selective components template rendering failed"
exit 1
fi

# Bug detection
print_status "Running bug detection tests..."

# Check for the metadatadb password bug
TEMPLATE_OUTPUT=$(helm template test-bug . --set metaflow-ui.enabled=true)
if echo "$TEMPLATE_OUTPUT" | grep -q "\.Values\.metadatadb\.password"; then
print_error "Found bug in metaflow-ui helpers - using .Values.metadatadb.password instead of .Values.uiBackend.metadatadb.password"
exit 1
fi

print_status "✓ Bug detection passed"

print_status "All tests completed successfully!"
print_status "Chart validation passed ✓"