-
Notifications
You must be signed in to change notification settings - Fork 124
224 lines (210 loc) · 7.44 KB
/
catpowder.yml
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
name: Catpowder (Linux Raw Sockets)
concurrency:
group: catpowder
cancel-in-progress: false
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
- unstable
- dev
env:
LIBOS: catpowder
SERVER: ${{ secrets.CATPOWDER_HOSTNAME_A }}
CLIENT: ${{ secrets.CATPOWDER_HOSTNAME_B }}
SERVER_ADDR: 10.3.1.20
CLIENT_ADDR: 10.3.1.21
jobs:
debug-pipeline:
name: Catpowder Debug Pipeline (Linux Raw Sockets)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup SSH
shell: bash
run: |
mkdir -p $HOME/.ssh/
echo "${{ secrets.SSHKEY }}" > "$HOME/.ssh/id_rsa"
chmod 400 $HOME/.ssh/id_rsa
echo "Host *" > $HOME/.ssh/config
echo -e "\tStrictHostKeyChecking no" >> $HOME/.ssh/config
echo -e "\tIdentityFile $HOME/.ssh/id_rsa" >> $HOME/.ssh/config
echo -e "\tIdentitiesOnly yes" >> $HOME/.ssh/config
echo -e "\tPasswordAuthentication no" >> $HOME/.ssh/config
echo -e "\tUser ${{ secrets.USERNAME }}" >> $HOME/.ssh/config
echo -e "\tPort ${{ secrets.PORTNUM }}" >> $HOME/.ssh/config
- name: Bootstrap VMs
shell: bash
run: |
echo "Running iptables rule on SERVER"
ssh $SERVER "sudo iptables -C OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP || \
sudo iptables -A OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP"
echo "Running ip addr flush on SERVER"
ssh $SERVER "sudo ip -br addr show dev eth1 | grep -q ' UP ' && \
sudo ip addr flush dev eth1"
echo "Running iptables rule on CLIENT"
ssh $CLIENT "sudo iptables -C OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP || \
sudo iptables -A OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP"
echo "Running ip addr flush on CLIENT"
ssh $CLIENT "sudo ip -br addr show dev eth1 | grep -q ' UP ' && \
sudo ip addr flush dev eth1"
- name: Run
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
branch_name="${{ github.head_ref }}"
else
branch_name="${{ github.ref_name }}"
fi
python3 tools/demikernel_ci.py \
--platform linux \
--server $SERVER \
--client $CLIENT \
--repository demikernel \
--branch origin/$branch_name \
--debug \
--libos $LIBOS \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: catpowder-debug-pipeline-logs
path: |
**/*.stdout.txt
**/*.stderr.txt
release-pipeline:
name: Catpowder Release Pipeline (Linux Raw Sockets)
needs: debug-pipeline
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup SSH
shell: bash
run: |
mkdir -p $HOME/.ssh/
echo "${{ secrets.SSHKEY }}" > "$HOME/.ssh/id_rsa"
chmod 400 $HOME/.ssh/id_rsa
echo "Host *" > $HOME/.ssh/config
echo -e "\tStrictHostKeyChecking no" >> $HOME/.ssh/config
echo -e "\tIdentityFile $HOME/.ssh/id_rsa" >> $HOME/.ssh/config
echo -e "\tIdentitiesOnly yes" >> $HOME/.ssh/config
echo -e "\tPasswordAuthentication no" >> $HOME/.ssh/config
echo -e "\tUser ${{ secrets.USERNAME }}" >> $HOME/.ssh/config
echo -e "\tPort ${{ secrets.PORTNUM }}" >> $HOME/.ssh/config
- name: Bootstrap VMs
shell: bash
run: |
echo "Running iptables rule on SERVER"
ssh $SERVER "sudo iptables -C OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP || \
sudo iptables -A OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP"
echo "Running ip addr flush on SERVER"
ssh $SERVER "sudo ip -br addr show dev eth1 | grep -q ' UP ' && \
sudo ip addr flush dev eth1"
echo "Running iptables rule on CLIENT"
ssh $CLIENT "sudo iptables -C OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP || \
sudo iptables -A OUTPUT -p tcp -o eth1 --tcp-flags RST RST -j DROP"
echo "Running ip addr flush on CLIENT"
ssh $CLIENT "sudo ip -br addr show dev eth1 | grep -q ' UP ' && \
sudo ip addr flush dev eth1"
- name: Run
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
branch_name="${{ github.head_ref }}"
else
branch_name="${{ github.ref_name }}"
fi
python3 tools/demikernel_ci.py \
--platform linux \
--server $SERVER \
--client $CLIENT \
--repository demikernel \
--branch origin/$branch_name \
--libos $LIBOS \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: catpowder-release-pipeline-logs
path: |
**/*.stdout.txt
**/*.stderr.txt
report-performance:
name: Catpowder Performance Report (Linux Raw Sockets)
needs: release-pipeline
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
deployments: read
packages: none
pull-requests: write
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Release Pipeline Logs
uses: actions/download-artifact@v4
with:
name: catpowder-release-pipeline-logs
path: ./catpowder_release_pipeline_logs
- name: Setup FlameGraph Repository
run: |
git clone https://github.com/brendangregg/FlameGraph.git /tmp/FlameGraph
- name: Parse Statistics
id: parse-stats
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
branch_name="${{ github.head_ref }}"
else
branch_name="${{ github.ref_name }}"
fi
pip install pandas tabulate
stats=$(python3 tools/perf.py \
--branch origin/$branch_name \
--libos $LIBOS \
--log-dir ./catpowder_release_pipeline_logs)
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "MESSAGE<<$EOF" >> $GITHUB_OUTPUT
echo "$stats" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
fi
- name: Archive Performance Data
uses: actions/upload-artifact@v4
with:
name: performance-data
path: |
**/perf_data.csv
**/flamegraph.svg
- name: Report Statistics
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const message = `${{ steps.parse-stats.outputs.MESSAGE }}`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
})