-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (179 loc) · 7.26 KB
/
Copy pathserver-setup-e2e.yml
File metadata and controls
198 lines (179 loc) · 7.26 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
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
name: Ordinary server setup E2E
on:
push:
paths:
- ".github/workflows/server-setup-e2e.yml"
- "scripts/ci/ordinary-server-setup-e2e.sh"
- "scripts/ci/packaged_local_communication_e2e.py"
- "npm/**"
- "src/agentnet/approval/cli_commands.py"
- "src/agentnet/cli.py"
- "src/agentnet/core/app.py"
- "src/agentnet/operations/server_setup.py"
- "src/agentnet/storage/postgres.py"
- "skills/agentnet-operator/**"
- "package.json"
- "package-lock.json"
- "pyproject.toml"
- "uv.lock"
pull_request:
paths:
- ".github/workflows/server-setup-e2e.yml"
- "scripts/ci/ordinary-server-setup-e2e.sh"
- "npm/**"
- "src/agentnet/approval/cli_commands.py"
- "scripts/ci/packaged_local_communication_e2e.py"
- "src/agentnet/cli.py"
- "src/agentnet/core/app.py"
- "src/agentnet/operations/server_setup.py"
- "src/agentnet/storage/postgres.py"
- "skills/agentnet-operator/**"
- "package.json"
- "package-lock.json"
- "pyproject.toml"
- "uv.lock"
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
ubuntu-24-postgresql-18:
name: Ubuntu 24.04 / PostgreSQL 18 clean install
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Configure Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: "24.18.0"
package-manager-cache: false
- name: Install pinned npm CLI
shell: bash
run: |
npm install --global npm@12.0.1 --ignore-scripts --no-audit --no-fund
test "$(node --version)" = "v24.18.0"
test "$(npm --version)" = "12.0.1"
- name: Configure uv and Python
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
version: "0.11.28"
python-version: "3.13.13"
enable-cache: false
- name: Install PostgreSQL 18, ClamAV, and local route dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y postgresql-common nginx jq openssl ca-certificates
sudo apt-get install -y clamav-daemon clamav-freshclam
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
sudo apt-get update
sudo apt-get install -y postgresql-18
while read -r version cluster _; do
sudo pg_dropcluster --stop "$version" "$cluster"
done < <(pg_lsclusters --no-header)
sudo pg_createcluster 18 main --port 5432 --start
sudo -u postgres psql -Atq --dbname=postgres -c "SHOW server_version" | grep -E '^18\.'
- name: Start the maintained ClamAV daemon
shell: bash
run: |
set -euo pipefail
sudo systemctl stop clamav-freshclam.service
sudo freshclam --quiet
sudo systemctl start clamav-freshclam.service
# Use the distribution's own local socket rather than reconfiguring
# the maintained daemon; the package has no clamd.conf.d directory.
sudo systemctl restart clamav-daemon.service
for _ in $(seq 1 180); do
if sudo clamdscan --ping 1 >/dev/null 2>&1; then
sudo test -S /var/run/clamav/clamd.ctl
exit 0
fi
sleep 1
done
echo "clamd did not answer on /var/run/clamav/clamd.ctl" >&2
sudo journalctl -u clamav-daemon.service --no-pager -n 40 >&2 || true
exit 1
- name: Run clean installed-artifact setup lifecycle
shell: bash
run: scripts/ci/ordinary-server-setup-e2e.sh
- name: Verify E2E cleanup
if: ${{ always() }}
shell: bash
run: |
set -euo pipefail
! getent passwd agentnet >/dev/null
! getent passwd agentnet-approval >/dev/null
! getent passwd agentnet-c0 >/dev/null
! getent group agentnet >/dev/null
! getent group agentnet-approval >/dev/null
! getent group agentnet-c0 >/dev/null
for path in \
/opt/agentnet-e2e \
/var/lib/agentnet \
/var/lib/agentnet-approval \
/var/lib/agentnet-c0 \
/var/lib/agentnet-setup \
/etc/agentnet-secrets \
/etc/systemd/system/agentnet-core.service \
/etc/systemd/system/agentnet-approval.service \
/etc/systemd/system/agentnet-c0-responder.service \
/etc/systemd/system/agentnet-credential-renew.service \
/etc/systemd/system/agentnet-credential-renew.timer \
/etc/nginx/sites-enabled/agentnet-e2e \
/etc/nginx/sites-available/agentnet-e2e \
/usr/local/share/ca-certificates/agentnet-e2e.crt \
/etc/ssl/certs/agentnet-e2e.crt \
/etc/ssl/certs/agentnet-e2e.pem \
/etc/ssl/private/agentnet-e2e.key \
"$RUNNER_TEMP/agentnet-ordinary-server-e2e"; do
! sudo test -e "$path"
done
! grep -Fq '# agentnet-e2e' /etc/hosts
HBA_FILE="$(sudo -u postgres psql -Atq --dbname=postgres -c 'SHOW hba_file')"
! sudo grep -Fq '# agentnet-e2e' "$HBA_FILE"
[[ "$(sudo -u postgres psql -Atq --dbname=postgres -c "SELECT count(*) FROM pg_roles WHERE rolname='agentnet'")" == "0" ]]
[[ "$(sudo -u postgres psql -Atq --dbname=postgres -c "SELECT count(*) FROM pg_database WHERE datname='agentnet'")" == "0" ]]
ubuntu-24-installed-roundtrip:
name: Ubuntu 24.04 / installed package communication roundtrip
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Configure Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: "24.18.0"
package-manager-cache: false
- name: Install pinned npm CLI
shell: bash
run: |
npm install --global npm@12.0.1 --ignore-scripts --no-audit --no-fund
test "$(node --version)" = "v24.18.0"
test "$(npm --version)" = "12.0.1"
- name: Configure uv and Python
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
version: "0.11.28"
python-version: "3.13.13"
enable-cache: false
- name: Install Linux process sandbox
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y apparmor-profiles apparmor-utils bubblewrap
sudo install -m 0644 \
/usr/share/apparmor/extra-profiles/bwrap-userns-restrict \
/etc/apparmor.d/bwrap-userns-restrict
sudo apparmor_parser -r /etc/apparmor.d/bwrap-userns-restrict
bwrap --unshare-user --die-with-parent --ro-bind / / /usr/bin/true
- name: Install locked package tooling
run: npm ci --ignore-scripts
- name: Run installed package communication and obligation roundtrip
run: npm run check:packed