test(e2e): fail fast on token/bucket misconfig and preserve mount pod… #362
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: | |
| group: aws-general-8-plus | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee | |
| with: | |
| version: latest | |
| test: | |
| name: Test | |
| runs-on: | |
| group: aws-general-8-plus | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - run: go test -race -v ./... | |
| build: | |
| name: Build | |
| runs-on: | |
| group: aws-general-8-plus | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - run: CGO_ENABLED=0 GOOS=linux go build -o /dev/null ./cmd/hf-csi-driver/ | |
| helm-lint: | |
| name: Helm Lint | |
| runs-on: | |
| group: aws-general-8-plus | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: azure/setup-helm@v5 | |
| - run: | | |
| helm lint deploy/helm/hf-csi-driver/ | |
| helm lint deploy/helm/hf-csi-driver/ --set webhook.enabled=true | |
| build-hf-mount: | |
| name: Build hf-mount image | |
| runs-on: | |
| group: aws-general-8-plus | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Resolve hf-mount ref | |
| id: ref | |
| run: | | |
| # PR branches that need an unmerged hf-mount change can override | |
| # the ref by committing a `.hf-mount-ref` file at repo root. | |
| REF="$(cat .hf-mount-ref 2>/dev/null || echo main)" | |
| # Validate ref to prevent command injection | |
| if ! echo "$REF" | grep -qE '^[a-zA-Z0-9/_.-]+$'; then | |
| echo "Error: Invalid ref format in .hf-mount-ref" | |
| exit 1 | |
| fi | |
| echo "ref=$REF" >> "$GITHUB_OUTPUT" | |
| echo "Using hf-mount ref: $REF" | |
| - run: | | |
| REF="${{ steps.ref.outputs.ref }}" | |
| # Additional validation before git clone | |
| if ! echo "$REF" | grep -qE '^[a-zA-Z0-9/_.-]+$'; then | |
| echo "Error: Invalid ref format" | |
| exit 1 | |
| fi | |
| git clone --depth 1 -b "$REF" https://github.com/huggingface/hf-mount.git /tmp/hf-mount | |
| - run: | | |
| docker build -t hf-mount-fuse:v0.3.1 /tmp/hf-mount | |
| docker save hf-mount-fuse:v0.3.1 -o /tmp/hf-mount-fuse.tar | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: hf-mount-fuse-image | |
| path: /tmp/hf-mount-fuse.tar | |
| retention-days: 1 | |
| compression-level: 0 | |
| e2e-podmount: | |
| name: E2E (podmount) | |
| needs: [build, helm-lint, build-hf-mount] | |
| runs-on: | |
| group: aws-general-8-plus | |
| env: | |
| KUBERNETES_SERVICE_HOST: "" | |
| CLUSTER_NAME: e2e-podmount | |
| DRIVER_IMAGE: hf-csi-driver:test | |
| HF_MOUNT_IMAGE: hf-mount-fuse:v0.3.1 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: azure/setup-helm@v5 | |
| - name: Install kind | |
| run: | | |
| mkdir -p "$HOME/bin" | |
| curl -fsSL -o "$HOME/bin/kind" https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 | |
| chmod +x "$HOME/bin/kind" | |
| echo "$HOME/bin" >> "$GITHUB_PATH" | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: hf-mount-fuse-image | |
| path: /tmp | |
| - name: Load hf-mount image | |
| run: docker load -i /tmp/hf-mount-fuse.tar | |
| - name: Setup cluster (podmount) | |
| run: test/e2e/setup-cluster.sh podmount | |
| - name: Start mount pod log collector | |
| run: | | |
| mkdir -p /tmp/hf-mount-logs | |
| nohup test/e2e/collect-mount-logs.sh /tmp/hf-mount-logs >/tmp/hf-mount-logs/collector.out 2>&1 & | |
| - name: 01-mount # public repo, PV+PVC mount + verify mount pod / HFMount CRD | |
| run: test/e2e/podmount/01-mount.sh | |
| - name: 02-resilience-driver-restart | |
| run: test/e2e/podmount/02-resilience-driver-restart.sh | |
| - name: 03-kill-mount-pod | |
| run: test/e2e/podmount/03-kill-mount-pod.sh | |
| - name: 04-unmount-cleanup | |
| run: test/e2e/podmount/04-unmount-cleanup.sh | |
| - name: 05-remount | |
| run: test/e2e/podmount/05-remount.sh | |
| - name: 06-multi-volume | |
| run: test/e2e/podmount/06-multi-volume.sh | |
| - name: 07-ephemeral | |
| run: test/e2e/podmount/07-ephemeral.sh | |
| - name: 08-mount-failure | |
| run: test/e2e/podmount/08-mount-failure.sh | |
| - name: 09-bucket-rw | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: test/e2e/podmount/09-bucket-rw.sh | |
| - name: 10-fsgroup | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: test/e2e/podmount/10-fsgroup.sh | |
| - name: Debug on failure | |
| if: failure() | |
| run: test/e2e/podmount/99-debug.sh | |
| e2e-sidecar: | |
| name: E2E (sidecar) | |
| needs: [build, helm-lint, build-hf-mount] | |
| runs-on: | |
| group: aws-general-8-plus | |
| env: | |
| KUBERNETES_SERVICE_HOST: "" | |
| CLUSTER_NAME: e2e-sidecar | |
| DRIVER_IMAGE: hf-csi-driver:test | |
| HF_MOUNT_IMAGE: hf-mount-fuse:v0.3.1 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: azure/setup-helm@v5 | |
| - name: Install kind | |
| run: | | |
| mkdir -p "$HOME/bin" | |
| curl -fsSL -o "$HOME/bin/kind" https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 | |
| chmod +x "$HOME/bin/kind" | |
| echo "$HOME/bin" >> "$GITHUB_PATH" | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: hf-mount-fuse-image | |
| path: /tmp | |
| - name: Load hf-mount image | |
| run: docker load -i /tmp/hf-mount-fuse.tar | |
| - name: Setup cluster (sidecar) | |
| run: test/e2e/setup-cluster.sh sidecar | |
| - name: 01-ephemeral | |
| run: test/e2e/sidecar/01-ephemeral.sh | |
| - name: 02-sidecar-injected | |
| run: test/e2e/sidecar/02-sidecar-injected.sh | |
| - name: 03-no-mount-pods | |
| run: test/e2e/sidecar/03-no-mount-pods.sh | |
| - name: 04-pv-token | |
| run: test/e2e/sidecar/04-pv-token.sh | |
| - name: 05-bucket-rw | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: test/e2e/sidecar/05-bucket-rw.sh | |
| - name: 06-fsgroup | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: test/e2e/sidecar/06-fsgroup.sh | |
| - name: 07-token-perms | |
| run: test/e2e/sidecar/07-token-perms.sh | |
| - name: 08-multi-volume | |
| run: test/e2e/sidecar/08-multi-volume.sh | |
| - name: 09-stuck-sidecar | |
| run: test/e2e/sidecar/09-stuck-sidecar.sh | |
| - name: Debug on failure | |
| if: failure() | |
| run: test/e2e/sidecar/99-debug.sh |