Skip to content

Commit eca662a

Browse files
committed
WIP
Signed-off-by: Martynas Pumputis <[email protected]>
1 parent e834c1c commit eca662a

File tree

7 files changed

+192
-74
lines changed

7 files changed

+192
-74
lines changed

.github/actions/pwru-test/action.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ runs:
3131
- name: PWRU test
3232
uses: cilium/little-vm-helper@e87948476ca97050b1f149ab2aec379d0de19b84 # v0.0.23
3333
with:
34-
ssh-port: ${{ inputs.ssh-port }}
3534
provision: 'false'
3635
cmd: |
3736
set -x
@@ -60,7 +59,6 @@ runs:
6059
if: ${{ !success() }}
6160
uses: cilium/little-vm-helper@e87948476ca97050b1f149ab2aec379d0de19b84 # v0.0.23
6261
with:
63-
ssh-port: ${{ inputs.ssh-port }}
6462
provision: 'false'
6563
cmd: |
6664
mkdir -p /host/logs/${{ inputs.test-name }}

.github/workflows/test.yml

Lines changed: 57 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
arm64-runner-ec2-ami: ami-04dd2037804df8ff9
2323
arm64-runner-group: cilium-pwru-runners
2424
arm64-runner-label: cilium-pwru-runners-arm64-${{ github.run_id }}
25-
arm64-runner-count: 7
25+
arm64-runner-count: 1 # TODO(7)
2626

2727
jobs:
2828

@@ -47,24 +47,26 @@ jobs:
4747
- name: Generate and build
4848
run: |
4949
make release
50-
tar xfv release/pwru-linux-amd64.tar.gz
5150
5251
- name: Store executable
5352
uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8
5453
with:
5554
name: pwru
56-
path: pwru
55+
path: release/pwru-linux-*.tar.gz
5756

5857
- name: Build test-app
58+
shell: bash
5959
run: |
6060
cd test-app
61-
go build .
61+
for arch in amd64 arm64; do
62+
GOARCH=${arch} go build -o test-app-${arch} .
63+
done
6264
6365
- name: Store test-app
6466
uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8
6567
with:
6668
name: test-app
67-
path: test-app/test-app
69+
path: test-app/test-app-*
6870

6971
arm64-runner-provision:
7072
needs: [build]
@@ -105,59 +107,39 @@ jobs:
105107
strategy:
106108
fail-fast: false
107109
matrix:
108-
os: ['ubuntu-latest', 'cilium-pwru-runners-arm64-${{ github.run_id }}']
109-
kernel: [ '5.4-20241218.004849', '5.10-20241218.004849', '5.15-20241218.004849', '6.1-20241218.004849', '6.6-20241218.004849', '6.12-20241218.004849', 'bpf-next-20250105.013256' ]
110+
os:
111+
# - 'ubuntu-latest'
112+
- 'cilium-pwru-runners-arm64-${{ github.run_id }}'
113+
kernel:
114+
# - '5.4-20241218.004849'
115+
# - '5.10-20241218.004849'
116+
# - '5.15-20241218.004849'
117+
# - '6.1-20241218.004849'
118+
- '6.6-20241218.004849'
119+
# - '6.12-20241218.004849'
120+
# - 'bpf-next-20250105.013256'
121+
# TODO check obsolete kernels
110122
timeout-minutes: 60
111123
runs-on: ${{ matrix.os }}
112124
steps:
113125
- uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f
114126

115-
- name: Set up job variables
116-
id: vars
117-
run: |
118-
if [[ "${{ matrix.os }}" == "cilium-pwru-runners-arm64-${{ github.run_id }}" ]]
119-
then
120-
# this is racy but it should be fine
121-
ssh_port=$(python3 -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
122-
echo metal_arm64=true >> $GITHUB_OUTPUT
123-
echo lvh_install_deps=false >> $GITHUB_OUTPUT
124-
echo lvh_kernel="/home/runners/vmlinuz-${{ matrix.kernel }}" >> $GITHUB_OUTPUT
125-
echo ssh_port=$ssh_port >> $GITHUB_OUTPUT
126-
echo shared_folder="/home/runners" >> $GITHUB_OUTPUT
127-
else
128-
echo metal_arm64=false >> $GITHUB_OUTPUT
129-
echo lvh_install_deps=true >> $GITHUB_OUTPUT
130-
echo lvh_kernel="" >> $GITHUB_OUTPUT
131-
echo ssh_port=2222 >> $GITHUB_OUTPUT
132-
echo shared_folder="" >> $GITHUB_OUTPUT
133-
fi
134-
135-
- name: Install GO
136-
if: steps.vars.outputs.metal_arm64 == 'true'
137-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
138-
with:
139-
go-version: '1.23.2'
140-
141-
- name: Install LVH CLI
142-
if: steps.vars.outputs.metal_arm64 == 'true'
143-
run: |
144-
go install github.com/cilium/little-vm-helper/cmd/lvh@latest
145-
# Move it into /bin folder, so that LVH action can detect it further
146-
sudo mv $(which lvh) /bin/lvh
147-
148127
- name: Retrieve stored pwru executable
149128
uses: actions/download-artifact@448e3f862ab3ef47aa50ff917776823c9946035b
150129
with:
151130
name: pwru
152-
path: pwru
153131

154132
- name: Retrieve stored test-app executable
155133
uses: actions/download-artifact@448e3f862ab3ef47aa50ff917776823c9946035b
156134
with:
157135
name: test-app
158-
path: test-app
159136

160-
- name: Derive kernel version
137+
- name: Install stored executables
138+
shell: bash
139+
run: |
140+
tar xfv pwru-linux-${{ steps.vars.outputs.arch }}.tar.gz
141+
142+
- name: Derive kernel version, arch
161143
id: kernel
162144
run: |
163145
if [[ "${{ matrix.kernel }}" == bpf-next* ]]; then
@@ -174,32 +156,35 @@ jobs:
174156
175157
echo "vsn=${major}${minor}" >> "$GITHUB_OUTPUT"
176158
177-
- name: Download the kernel
178-
if: steps.vars.outputs.metal_arm64 == 'true'
179-
run: |
180-
if [ ! -e "${{ steps.vars.outputs.shared_folder }}/vmlinuz-${{ matrix.kernel }}" ]; then
181-
lvh kernel pull ${{ matrix.kernel }}
182-
mkdir -p ${{ steps.vars.outputs.shared_folder }}
183-
mv ${{ matrix.kernel }}/boot/vmlinuz* ${{ steps.vars.outputs.shared_folder }}/vmlinuz-${{ matrix.kernel }}
184-
rm -rf ${{ matrix.kernel }}
159+
if [[ "${{ matrix.os }}" == "cilium-pwru-runners-arm64-${{ github.run_id }}" ]]
160+
then
161+
echo arch=arm64 >> $GITHUB_OUTPUT
162+
echo kernel-version=${{ matrix.kernel}} >> $GITHUB_OUTPUT
163+
else
164+
echo arch=amd64 >> $GITHUB_OUTPUT
165+
echo kernel-version="" >> $GITHUB_OUTPUT # for amd64 we can use kernel from lvh image
185166
fi
186167
187168
- name: Provision LVH VMs
188-
uses: cilium/little-vm-helper@e87948476ca97050b1f149ab2aec379d0de19b84 # v0.0.23
169+
uses: cilium/little-vm-helper@12677b10f89edec8f94ae8e1872aa680bbb83ce7
189170
with:
190-
install-dependencies: ${{ steps.vars.outputs.lvh_install_deps }}
191-
images-folder-parent: ${{ steps.vars.outputs.shared_folder }}
192-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
171+
lvh-version: 'v0.0.23'
193172
mem: 4G
194173
cpu: 2
195174
test-name: pwru-test
196175
image-version: ${{ matrix.kernel }}
197-
kernel: '${{ steps.vars.outputs.lvh_kernel }}'
176+
kernel-version: ${{ steps.kernel.outputs.kernel-version }}
177+
arch: ${{ steps.kernel.outputs.arch }}
198178
host-mount: ./
199179
cmd: |
200-
chmod +x /host/pwru/pwru
201-
chmod +x /host/test-app/test-app
202-
180+
mkdir /host/pwru-tmp
181+
chmod +x /host/pwru
182+
mv /host/pwru /host/pwru-tmp/
183+
mv /host/pwru-tmp /host/pwru
184+
185+
chmod +x /host/test-app-${{ steps.vars.outputs.arch }}
186+
mv /host/test-app-${{ steps.vars.outputs.arch }} /host/test-app/test-app
187+
203188
# wait for network to be available
204189
while true;
205190
do
@@ -213,7 +198,6 @@ jobs:
213198
- name: Test basic IPv4
214199
uses: ./.github/actions/pwru-test
215200
with:
216-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
217201
test-name: ${{ matrix.kernel }}-basic-ipv4
218202
pwru-pcap-filter: 'dst host 1.0.0.1 and port 8080'
219203
setup: |
@@ -225,7 +209,6 @@ jobs:
225209
- name: Test basic IPv6
226210
uses: ./.github/actions/pwru-test
227211
with:
228-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
229212
test-name: ${{ matrix.kernel }}-basic-ipv6
230213
pwru-pcap-filter: 'dst host 2606:4700:4700::1001 and port 8080'
231214
setup: |
@@ -237,7 +220,6 @@ jobs:
237220
- name: Test advanced IPv4
238221
uses: ./.github/actions/pwru-test
239222
with:
240-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
241223
test-name: ${{ matrix.kernel }}-advanced-ipv4
242224
pwru-pcap-filter: 'tcp[tcpflags] = tcp-syn'
243225
setup: |
@@ -249,7 +231,6 @@ jobs:
249231
- name: Test advanced IPv6
250232
uses: ./.github/actions/pwru-test
251233
with:
252-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
253234
test-name: ${{ matrix.kernel }}-advanced-ipv6
254235
pwru-pcap-filter: 'ip6[53] & 0x3f = 0x2'
255236
setup: |
@@ -261,7 +242,6 @@ jobs:
261242
- name: Test pcap filter using stack
262243
uses: ./.github/actions/pwru-test
263244
with:
264-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
265245
test-name: ${{ matrix.kernel }}-pcap-filter-stack
266246
pwru-pcap-filter: '(((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
267247
gen-traffic: curl -vvv -sS --fail --connect-timeout "1" -o /dev/null http://1.1.1.1 || true; sleep 5
@@ -270,7 +250,6 @@ jobs:
270250
- name: Test --filter-track-skb
271251
uses: ./.github/actions/pwru-test
272252
with:
273-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
274253
test-name: ${{ matrix.kernel }}-filter-track-skb
275254
pwru-flags: --filter-track-skb
276255
pwru-pcap-filter: dst host 10.10.20.99
@@ -283,7 +262,6 @@ jobs:
283262
- name: Test ARP filter
284263
uses: ./.github/actions/pwru-test
285264
with:
286-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
287265
test-name: ${{ matrix.kernel }}-filter-arp
288266
pwru-pcap-filter: 'arp and arp[7] = 1 and arp[24]= 169 and arp[25] = 254 and arp[26] = 0 and arp[27] = 1'
289267
setup: |
@@ -303,7 +281,6 @@ jobs:
303281
- name: Test --filter-ifname
304282
uses: ./.github/actions/pwru-test
305283
with:
306-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
307284
test-name: ${{ matrix.kernel }}-filter-ifname
308285
pwru-flags: --filter-ifname lo
309286
pwru-pcap-filter: icmp
@@ -315,7 +292,6 @@ jobs:
315292
if: ${{ steps.kernel.outputs.vsn >= 518 }}
316293
uses: ./.github/actions/pwru-test
317294
with:
318-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
319295
test-name: ${{ matrix.kernel }}-kprobe-multi-basic
320296
pwru-flags: --backend=kprobe-multi
321297
pwru-pcap-filter: 'dst host 1.0.0.1 and port 8080'
@@ -329,7 +305,6 @@ jobs:
329305
if: ${{ steps.kernel.outputs.vsn >= 606 }}
330306
uses: ./.github/actions/pwru-test
331307
with:
332-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
333308
test-name: ${{ matrix.kernel }}-filter-trace-tc-xdp
334309
pwru-flags: --filter-trace-tc --filter-trace-xdp
335310
pwru-pcap-filter: 'dst host 1.0.0.1 and port 8080'
@@ -348,14 +323,26 @@ jobs:
348323
if: ${{ !success() }}
349324
uses: cilium/little-vm-helper@e87948476ca97050b1f149ab2aec379d0de19b84 # v0.0.23
350325
with:
351-
ssh-port: ${{ steps.vars.outputs.ssh_port }}
352326
provision: 'false'
353327
cmd: |
354328
for i in /tmp/pwru-*.status /tmp/pwru-*.ready /tmp/pwru-*.log; do
355329
echo "--- \$i ---"
356330
cat \$i || true
357331
done
358332
333+
- name: Tmate deps
334+
if: ${{ failure() }}
335+
run: |
336+
sudo apt update
337+
sudo apt-get install -y tmate
338+
339+
- name: Setup tmate session
340+
if: ${{ failure() }}
341+
uses: mxschmitt/action-tmate@v3
342+
timeout-minutes: 20
343+
with:
344+
install-dependencies: false
345+
359346
arm64-runner-destroy:
360347
needs: [arm64-runner-provision, test]
361348
if: always() && needs.arm64-runner-provision.result != 'skipped'

test-app/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
test-app
1+
test-app*

0 commit comments

Comments
 (0)