name: "helm: lint and test charts" on: push: branches: [ master ] paths: ['k8s/**', '.github/workflows/helm_ci.yml', '.github/scripts/helm_jwt_keys.py'] pull_request: branches: [ master ] paths: ['k8s/**', '.github/workflows/helm_ci.yml', '.github/scripts/helm_jwt_keys.py'] permissions: contents: read jobs: lint-test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: fetch-depth: 0 - name: Set up Helm before fromToml was available uses: azure/setup-helm@v5 with: version: v3.16.3 - name: Record legacy Helm binary run: echo "HELM_LEGACY=$(command -v helm)" >> "$GITHUB_ENV" - name: Set up Helm uses: azure/setup-helm@v5 with: version: v3.18.4 - uses: actions/setup-python@v7 with: python-version: '3.10' 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 legacy Helm rendering run: | "$HELM_LEGACY" lint k8s/charts/seaweedfs "$HELM_LEGACY" template test k8s/charts/seaweedfs > "$RUNNER_TEMP/legacy-default.yaml" "$HELM_LEGACY" template test k8s/charts/seaweedfs \ --set global.seaweedfs.securityConfig.jwtSigning.volumeRead=true \ --set global.seaweedfs.securityConfig.jwtSigning.filerWrite=true \ --set global.seaweedfs.securityConfig.jwtSigning.filerRead=true \ > "$RUNNER_TEMP/legacy-jwt.yaml" - 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 S3 rollout settings ===" helm template test $CHART_DIR --show-only templates/s3/s3-deployment.yaml \ --set s3.enabled=true > /tmp/s3-rollout-defaults.yaml grep -q "terminationGracePeriodSeconds: 10$" /tmp/s3-rollout-defaults.yaml test "$(grep -cE '^ strategy:|^ +lifecycle:' /tmp/s3-rollout-defaults.yaml)" -eq 0 helm template test $CHART_DIR --show-only templates/s3/s3-deployment.yaml \ --set s3.enabled=true \ --set s3.terminationGracePeriodSeconds=30 \ --set s3.updateStrategy.type=RollingUpdate \ --set s3.updateStrategy.rollingUpdate.maxUnavailable=0 \ --set-string 's3.lifecycle.preStop.exec.command={sleep,5}' \ > /tmp/s3-rollout.yaml grep -q "terminationGracePeriodSeconds: 30$" /tmp/s3-rollout.yaml grep -A 4 "^ strategy:" /tmp/s3-rollout.yaml | grep -q "maxUnavailable: 0" grep -A 4 "^ strategy:" /tmp/s3-rollout.yaml | grep -q "type: RollingUpdate" grep -A 5 "^ lifecycle:" /tmp/s3-rollout.yaml | grep -q -- "- sleep" echo "S3 rollout settings render correctly" echo "=== Testing the S3 config checksum is stable across renders ===" # s3-secret.yaml keeps its generated keys with lookup. Hashing the rendered # Secret drew new keys for the checksum whenever lookup found nothing (on # install), so the first upgrade changed the checksum and restarted the # filer and S3 pods although nothing had changed. s3_checksum() { #