-
Notifications
You must be signed in to change notification settings - Fork 17
161 lines (152 loc) · 4.28 KB
/
ci.yaml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: "CI"
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
timeout-minutes: 3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: cargo fetch
run: cargo fetch --verbose
- name: cargo check
run: cargo check --all-features --all-targets
if: always()
- name: cargo fmt
uses: actions-rust-lang/rustfmt@v1
if: always()
- id: clippy
run: cargo clippy --all-features --all-targets
if: always()
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kind_image:
- "v1.30.2"
- "v1.29.4"
- "v1.28.9"
- "v1.27.13"
- "v1.26.15"
- "v1.25.16"
- "v1.24.17"
env:
KIND_IMAGE: kindest/node:${{matrix.kind_image}}
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Setup kind
run: |
kind create cluster --image="$KIND_IMAGE" --name test-pgd
- run: cargo fetch --verbose
- run: cargo test --all-features
timeout-minutes: 5
tests-result:
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: All tests ok
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
lint-helm:
timeout-minutes: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: helm lint charts/pod-graceful-drain --strict
build-image:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker build --file docker/build.Dockerfile \
--tag "pod-graceful-drain:latest" \
.
- run: docker image save --output pod-graceful-drain.tar pod-graceful-drain
- uses: actions/upload-artifact@v4
with:
name: pod-graceful-drain.tar
path: ./pod-graceful-drain.tar
smoke-test:
timeout-minutes: 3
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kind_image:
- "v1.30.2"
- "v1.29.4"
- "v1.28.9"
- "v1.27.13"
- "v1.26.15"
- "v1.25.16"
- "v1.24.17"
env:
KIND_IMAGE: kindest/node:${{matrix.kind_image}}
needs:
- build-image
steps:
- uses: actions/checkout@v4
- name: Setup kind
run: |
kind create cluster --image="$KIND_IMAGE"
- uses: eifinger/setup-rye@v4
with:
version: '0.37.0'
- uses: actions/download-artifact@v4
with:
name: pod-graceful-drain.tar
- run: |
docker image load --input pod-graceful-drain.tar
kind load docker-image pod-graceful-drain:latest
- run: |
helm install pod-graceful-drain charts/pod-graceful-drain \
--create-namespace --namespace pod-graceful-drain \
--set image.repository=pod-graceful-drain --set image.tag=latest \
--set experimentalGeneralIngress=true \
--set logLevel=info\\,pod_graceful_drain=trace \
--wait=true --timeout=1m
- run: rye sync
- run: rye test
- name: Dump
if: always()
run: |
KUBECTL="kubectl --namespace pod-graceful-drain"
echo "::group::kubectl get"
${KUBECTL} get --ignore-not-found=true --output wide all
echo "::endgroup::"
echo "::group::kubectl describe"
${KUBECTL} describe all
echo "::endgroup::"
for POD in $(${KUBECTL} get pod -o=name); do
echo "::group::kubectl logs ${POD}"
${KUBECTL} logs --ignore-errors=true "${POD}"
echo "::endgroup::"
done
smoke-tests-result:
runs-on: ubuntu-latest
needs: smoke-test
if: always()
steps:
- name: All tests ok
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1