-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (86 loc) · 3.61 KB
/
test-e2e-bundle.yml
File metadata and controls
102 lines (86 loc) · 3.61 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
name: Bundle 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-bundle-e2e:
name: Bundle E2E Tests
runs-on: ubuntu-latest
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: Running Bundle e2e Tests
env:
REGISTRY_INSECURE: true
REGISTRY: kind-registry:5000
run: make test-e2e-bundle
- 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
# Collect operator logs from all test namespaces (bundle tests install into dynamic namespaces)
for ns in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' | grep '^test-'); do
kubectl logs -n "$ns" -l control-plane=controller-manager --tail=-1 --all-containers --prefix --timestamps > "/tmp/k8s-artifacts/operator-${ns}.log" 2>/dev/null || true
done
- name: Upload Kubernetes artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: bundle-e2e-logs
path: /tmp/k8s-artifacts/
retention-days: 7