-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (110 loc) · 4.7 KB
/
test-e2e.yml
File metadata and controls
131 lines (110 loc) · 4.7 KB
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
126
127
128
129
130
131
name: E2E Tests
on:
push:
branches:
- 'release-*' # for main branch we have the merge queue
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-e2e:
name: E2E Tests (${{ matrix.builder }}/${{ matrix.deployer }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
builder: [pack, s2i]
deployer: [knative, raw, keda]
steps:
- name: Free up disk space
run: |
# Remove large pre-installed toolchains not needed for K8s operator testing
sudo rm -rf \
/usr/share/dotnet \
/usr/local/lib/android \
/opt/ghc \
/opt/hostedtoolcache \
/usr/local/share/powershell \
/usr/share/swift \
/usr/local/.ghcup \
/usr/local/share/chromium \
/usr/local/lib/heroku
# Clean up Docker to start fresh
docker system prune -af --volumes
df -h
- name: Clone the code
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Verify kind installation
run: kind version
- name: Install helm
uses: azure/setup-helm@v5.0.0
# func CLI is needed in some e2e tests ATM
- name: Install func cli
uses: functions-dev/action@main
with:
version: nightly # use nightly as long as we use the latest in the operator too
- name: Setup KinD cluster
run: make create-kind-cluster
- name: Install func-operator
run: make docker-build docker-push deploy
- name: Pre-pull builder images to avoid parallel pull contention
run: |
# Pre-pull builder images before tests run in parallel to avoid:
# - Network bandwidth saturation (multiple 1-3GB pulls)
# - Disk I/O contention
# - Container runtime lock contention
if [ "${{ matrix.builder }}" = "s2i" ]; then
echo "Pre-pulling S2I builder images..."
docker pull registry.access.redhat.com/ubi8/go-toolset:latest || true
# for now we only download the go image, as we only use this in the e2e tests
kind load docker-image registry.access.redhat.com/ubi8/go-toolset:latest || true
elif [ "${{ matrix.builder }}" = "pack" ]; then
echo "Pre-pulling pack builder images..."
docker pull ghcr.io/knative/builder-jammy-base:v2 || true
docker pull ghcr.io/knative/builder-jammy-tiny:v2 || true
kind load docker-image ghcr.io/knative/builder-jammy-base:v2 || true
kind load docker-image ghcr.io/knative/builder-jammy-tiny:v2 || true
fi
echo "Builder images cached in KinD cluster"
- name: Running e2e Tests
env:
REGISTRY_INSECURE: true
REGISTRY: kind-registry:5000
DEFAULT_BUILDER: ${{ matrix.builder }}
DEFAULT_DEPLOYER: ${{ matrix.deployer }}
run: make test-e2e
- name: Collect Kubernetes artifacts
if: failure()
run: |
mkdir -p /tmp/k8s-artifacts
kubectl logs -n func-operator-system -l control-plane=controller-manager --tail=-1 --all-containers --prefix --timestamps > /tmp/k8s-artifacts/func-operator.log || true
for resource in functions deployments configmaps pipelineruns roles rolebindings; do
kubectl get ${resource} -A -o yaml > /tmp/k8s-artifacts/${resource}.yaml || true
done
# Install Tekton CLI for better PipelineRun log collection
curl -LO https://github.com/tektoncd/cli/releases/download/v0.44.1/tkn_0.44.1_Linux_x86_64.tar.gz
tar xvzf tkn_0.44.1_Linux_x86_64.tar.gz -C /tmp
chmod +x /tmp/tkn
# Collect logs from all pipelineruns using Tekton CLI
/tmp/tkn pipelinerun list -A > /tmp/k8s-artifacts/pipelinerun-list.txt 2>&1 || true
kubectl get pipelineruns -A -o json | jq -r '.items[] | "\(.metadata.namespace) \(.metadata.name)"' | while read ns name; do
/tmp/tkn pipelinerun logs $name -n $ns > /tmp/k8s-artifacts/pipelinerun-logs-${ns}-${name}.log 2>&1 || true
done
- name: Upload Kubernetes artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: func-operator-logs-${{ matrix.builder }}-${{ matrix.deployer }}
path: /tmp/k8s-artifacts/
retention-days: 7