aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/helm_ci.yml
blob: 268052a5a82f83031c15206efbec9ea0d5f3255f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: "helm: lint and test charts"

on:
  push:
    branches: [ master ]
    paths: ['k8s/**']
  pull_request:
    branches: [ master ]
    paths: ['k8s/**']

permissions:
  contents: read

jobs:
  lint-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
        with:
          fetch-depth: 0

      - name: Set up Helm
        uses: azure/setup-helm@v4
        with:
          version: v3.18.4

      - uses: actions/setup-python@v6
        with:
          python-version: '3.9'
          check-latest: true

      - name: Set up chart-testing
        uses: helm/chart-testing-action@v2.8.0

      - name: Run chart-testing (list-changed)
        id: list-changed
        run: |
          changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --chart-dirs k8s/charts)
          if [[ -n "$changed" ]]; then
            echo "::set-output name=changed::true"
          fi

      - name: Run chart-testing (lint)
        run: ct lint --target-branch ${{ github.event.repository.default_branch }} --all --validate-maintainers=false --chart-dirs k8s/charts

      - name: Verify template rendering
        run: |
          set -e
          CHART_DIR="k8s/charts/seaweedfs"
          
          echo "=== Testing default configuration ==="
          helm template test $CHART_DIR > /tmp/default.yaml
          echo "✓ Default configuration renders successfully"
          
          echo "=== Testing with S3 enabled ==="
          helm template test $CHART_DIR --set s3.enabled=true > /tmp/s3.yaml
          grep -q "kind: Deployment" /tmp/s3.yaml && grep -q "seaweedfs-s3" /tmp/s3.yaml
          echo "✓ S3 deployment renders correctly"
          
          echo "=== Testing with all-in-one mode ==="
          helm template test $CHART_DIR --set allInOne.enabled=true > /tmp/allinone.yaml
          grep -q "seaweedfs-all-in-one" /tmp/allinone.yaml
          echo "✓ All-in-one deployment renders correctly"
          
          echo "=== Testing with security enabled ==="
          helm template test $CHART_DIR --set global.enableSecurity=true > /tmp/security.yaml
          grep -q "security-config" /tmp/security.yaml
          echo "✓ Security configuration renders correctly"
          
          echo "=== Testing with monitoring enabled ==="
          helm template test $CHART_DIR \
            --set global.monitoring.enabled=true \
            --set global.monitoring.gatewayHost=prometheus \
            --set global.monitoring.gatewayPort=9091 > /tmp/monitoring.yaml
          echo "✓ Monitoring configuration renders correctly"
          
          echo "=== Testing with PVC storage ==="
          helm template test $CHART_DIR \
            --set master.data.type=persistentVolumeClaim \
            --set master.data.size=10Gi \
            --set master.data.storageClass=standard > /tmp/pvc.yaml
          grep -q "PersistentVolumeClaim" /tmp/pvc.yaml
          echo "✓ PVC configuration renders correctly"
          
          echo "=== Testing with custom replicas ==="
          helm template test $CHART_DIR \
            --set master.replicas=3 \
            --set filer.replicas=2 \
            --set volume.replicas=3 > /tmp/replicas.yaml
          echo "✓ Custom replicas configuration renders correctly"
          
          echo "=== Testing filer with S3 gateway ==="
          helm template test $CHART_DIR \
            --set filer.s3.enabled=true \
            --set filer.s3.enableAuth=true > /tmp/filer-s3.yaml
          echo "✓ Filer S3 gateway renders correctly"
          
          echo "=== Testing SFTP enabled ==="
          helm template test $CHART_DIR --set sftp.enabled=true > /tmp/sftp.yaml
          grep -q "seaweedfs-sftp" /tmp/sftp.yaml
          echo "✓ SFTP deployment renders correctly"
          
          echo "=== Testing ingress configurations ==="
          helm template test $CHART_DIR \
            --set master.ingress.enabled=true \
            --set filer.ingress.enabled=true \
            --set s3.enabled=true \
            --set s3.ingress.enabled=true > /tmp/ingress.yaml
          grep -q "kind: Ingress" /tmp/ingress.yaml
          echo "✓ Ingress configurations render correctly"
          
          echo "=== Testing COSI driver ==="
          helm template test $CHART_DIR --set cosi.enabled=true > /tmp/cosi.yaml
          grep -q "seaweedfs-cosi" /tmp/cosi.yaml
          echo "✓ COSI driver renders correctly"
          
          echo ""
          echo "✅ All template rendering tests passed!"

      - name: Create kind cluster
        uses: helm/kind-action@v1.13.0

      - name: Run chart-testing (install)
        run: ct install --target-branch ${{ github.event.repository.default_branch }} --all --chart-dirs k8s/charts