Skip to content

feat(ci): add e2e test validation to release workflow #769

feat(ci): add e2e test validation to release workflow

feat(ci): add e2e test validation to release workflow #769

Workflow file for this run

name: Run E2E Tests
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [ main ]
workflow_call:
outputs:
success:
description: 'Whether the e2e tests passed successfully'
value: ${{ jobs.e2e-tests.outputs.success }}
summary:
description: 'High-level summary of test results'
value: ${{ jobs.e2e-tests.outputs.summary }}
run_url:
description: 'URL to this workflow run for detailed logs'
value: ${{ jobs.e2e-tests.outputs.run_url }}
jobs:
e2e-tests:
runs-on: ubuntu-latest
outputs:
success: ${{ steps.test-results.outputs.success }}
summary: ${{ steps.test-results.outputs.summary }}
run_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: go.mod
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Create kind config
run: |
cat > kind-config.yaml << EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/etc/containerd/certs.d"
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=500Mi
eviction-hard: memory.available<200Mi
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF
- name: Create k8s Kind Cluster
id: kind
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
with:
registry: true
registry_name: kind-registry
registry_port: 5000
registry_enable_delete: true
config: kind-config.yaml
- name: Build operator image
run: |
# Build the image with run-based tag for uniqueness
docker build -t kind-registry:5000/llama-stack-k8s-operator:run-${{ github.run_id }} -f Dockerfile .
# Tag the image for local registry
docker tag kind-registry:5000/llama-stack-k8s-operator:run-${{ github.run_id }} kind-registry:5000/llama-stack-k8s-operator:latest
- name: Push operator image to local registry
run: |
docker push kind-registry:5000/llama-stack-k8s-operator:latest
- name: Deploy operator
run: |
# Deploy the operator
make deploy IMG=kind-registry:5000/llama-stack-k8s-operator:latest
# Wait for operator deployment to be ready
if ! kubectl wait --for=condition=available --timeout=300s deployment/llama-stack-k8s-operator-controller-manager -n llama-stack-k8s-operator-system; then
echo "Deployment failed to become ready. Debugging information:"
kubectl describe deployment llama-stack-k8s-operator-controller-manager -n llama-stack-k8s-operator-system
kubectl logs -l control-plane=controller-manager -n llama-stack-k8s-operator-system --tail=100
kubectl get events -n llama-stack-k8s-operator-system --sort-by='.lastTimestamp'
exit 1
fi
- name: Run e2e tests
run: |
make test-e2e
- name: Set test results
id: test-results
if: always()
run: |
if [ "${{ job.status }}" == "success" ]; then
echo "success=true" >> $GITHUB_OUTPUT
echo "summary=E2E tests passed successfully" >> $GITHUB_OUTPUT
else
echo "success=false" >> $GITHUB_OUTPUT
echo "summary=E2E tests failed - check logs for details" >> $GITHUB_OUTPUT
fi
- name: Get logs
if: ${{ always() }}
run: |
kubectl -n llama-stack-test get all -o yaml > all.log
kubectl -n llama-stack-k8s-operator-system logs deployment.apps/llama-stack-k8s-operator-controller-manager > controller-manager.log
kubectl -n llama-stack-test describe all > all-describe.log
kubectl -n llama-stack-test describe events > events.log
kubectl get llamastackdistributions --all-namespaces -o yaml > llamastackdistributions.log
- name: Upload all logs to artifacts
if: ${{ always() }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: logs-${{ github.run_id }}-${{ github.run_attempt }}
path: |
*.log
retention-days: 1