forked from banzaicloud/koperator
-
Notifications
You must be signed in to change notification settings - Fork 18
125 lines (107 loc) · 3.98 KB
/
Copy pathe2e-test.yaml
File metadata and controls
125 lines (107 loc) · 3.98 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
name: e2e-test
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REPOSITORY: koperator_e2e_test
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Clean workspace
run: |
# Remove any existing go.work files to ensure clean module resolution
rm -f go.work go.work.sum
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Setup Helm
uses: azure/setup-helm@v5
with:
version: '3.19.0'
- name: Clean Go module cache
run: |
# Clean any existing Go module cache to avoid conflicts
# Use sudo to handle permission issues and force removal
sudo rm -rf ~/go/pkg/mod || true
sudo rm -rf ~/.cache/go-build || true
mkdir -p ~/go/pkg/mod
mkdir -p ~/.cache/go-build
# Ensure proper permissions
chmod -R 755 ~/go/pkg/mod
chmod -R 755 ~/.cache/go-build
# Enable Tmate Session to debug the E2E Kind Cluster
# Only activates when re-running the workflow in debug mode
- name: Setup tmate session
if: ${{ runner.debug == '1' }}
continue-on-error: true
uses: mxschmitt/action-tmate@v3
with:
detached: true
limit-access-to-actor: true
- name: Build docker image
run: |
IMG=$REPOSITORY:$GITHUB_SHA make docker-build
- name: Setup Kind cluster
id: setup-kind
uses: ./.github/actions/kind-create
- name: Load image into kind cluster
run: |
kind load docker-image $REPOSITORY:$GITHUB_SHA --name e2e-kind
- name: Download dependencies
run: |
# Download dependencies for all modules
go mod download
cd api && go mod download && cd ..
cd properties && go mod download && cd ..
cd tests/e2e && go mod download && cd ../..
- name: Run E2E tests
env:
KUBECONFIG: ${{ steps.setup-kind.outputs.kubeconfig }}
run: |
# Clean any existing go.work files to avoid workspace conflicts
rm -f go.work go.work.sum
IMG_E2E=$REPOSITORY:$GITHUB_SHA make test-e2e
# Dump cluster diagnostics on failure so e2e failures (e.g. a dependency Helm
# install that times out under `--atomic`) are debuggable from the job log
# without needing a live tmate session.
- name: Dump diagnostics on failure
if: failure()
env:
KUBECONFIG: ${{ steps.setup-kind.outputs.kubeconfig }}
run: |
set +e
echo "::group::nodes"
kubectl get nodes -o wide
echo "::endgroup::"
echo "::group::all pods"
kubectl get pods -A -o wide
echo "::endgroup::"
for ns in cert-manager projectcontour zookeeper prometheus kafka; do
echo "::group::namespace ${ns}"
kubectl get pods -n "${ns}" -o wide
echo "----- events (${ns}) -----"
kubectl get events -n "${ns}" --sort-by=.lastTimestamp | tail -50
echo "----- describe pods (${ns}) -----"
kubectl describe pods -n "${ns}"
echo "----- container logs (${ns}) -----"
for pod in $(kubectl get pods -n "${ns}" -o name); do
echo ">>> ${pod} (current) <<<"
kubectl logs -n "${ns}" "${pod}" --all-containers --tail=150 --timestamps
echo ">>> ${pod} (previous, if the container restarted) <<<"
kubectl logs -n "${ns}" "${pod}" --all-containers --previous --tail=150 --timestamps
done
echo "::endgroup::"
done
echo "::group::warning events (all namespaces)"
kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp | tail -80
echo "::endgroup::"
exit 0