]>
Commit | Line | Data |
---|---|---|
99bb3530 PD |
1 | from invoke import task |
2 | from invoke.exceptions import Failure, UnexpectedExit | |
3 | ||
4ccb0f78 | 4 | import json |
7ec6fb65 | 5 | import os |
99bb3530 PD |
6 | import sys |
7 | import time | |
8 | ||
7d862cb3 AR |
9 | auth_backend_ip_addr = os.getenv('AUTH_BACKEND_IP_ADDR', '127.0.0.1') |
10 | ||
11 | clang_version = os.getenv('CLANG_VERSION', '13') | |
12 | ||
99bb3530 | 13 | all_build_deps = [ |
d3cb00f9 | 14 | 'ccache', |
99bb3530 PD |
15 | 'libboost-all-dev', |
16 | 'libluajit-5.1-dev', | |
17 | 'libsodium-dev', | |
b69425da | 18 | 'libssl-dev', # This will install libssl 1.1 on Debian 11 and libssl3 on Debian 12 |
99bb3530 PD |
19 | 'libsystemd-dev', |
20 | 'libtool', | |
21 | 'make', | |
22 | 'pkg-config', | |
23 | 'python3-venv', | |
24 | 'systemd', | |
25 | ] | |
26 | git_build_deps = [ | |
27 | 'autoconf', | |
28 | 'automake', | |
29 | 'bison', | |
30 | 'bzip2', | |
31 | 'curl', | |
32 | 'flex', | |
33 | 'git', | |
34 | 'ragel' | |
35 | ] | |
36 | auth_build_deps = [ # FIXME: perhaps we should be stealing these from the debian (Ubuntu) control file | |
37 | 'default-libmysqlclient-dev', | |
38 | 'libcdb-dev', | |
39 | 'libcurl4-openssl-dev', | |
40 | 'libgeoip-dev', | |
41 | 'libkrb5-dev', | |
42 | 'libldap2-dev', | |
43 | 'liblmdb-dev', | |
44 | 'libmaxminddb-dev', | |
45 | 'libp11-kit-dev', | |
46 | 'libpq-dev', | |
47 | 'libsqlite3-dev', | |
48 | 'libyaml-cpp-dev', | |
49 | 'libzmq3-dev', | |
50 | 'ruby-bundler', | |
51 | 'ruby-dev', | |
52 | 'sqlite3', | |
9f930bd7 | 53 | 'unixodbc-dev', |
26cf02ca | 54 | 'cmake', |
99bb3530 PD |
55 | ] |
56 | rec_build_deps = [ | |
57 | 'libcap-dev', | |
58 | 'libfstrm-dev', | |
59 | 'libsnmp-dev', | |
60 | ] | |
4467dd85 O |
61 | rec_bulk_deps = [ |
62 | 'curl', | |
4467dd85 O |
63 | 'libboost-all-dev', |
64 | 'libcap2', | |
2b219e37 O |
65 | 'libfstrm0', |
66 | 'libluajit-5.1-2', | |
7d862cb3 | 67 | '"libsnmp[1-9]+"', |
2b219e37 | 68 | 'libsodium23', |
4467dd85 | 69 | 'libsystemd0', |
2b219e37 O |
70 | 'moreutils', |
71 | 'pdns-tools', | |
869fc2b5 | 72 | 'unzip', |
4467dd85 | 73 | ] |
99bb3530 PD |
74 | dnsdist_build_deps = [ |
75 | 'libcap-dev', | |
76 | 'libcdb-dev', | |
77 | 'libedit-dev', | |
78 | 'libfstrm-dev', | |
79e3404d | 79 | 'libgnutls28-dev', |
99bb3530 PD |
80 | 'libh2o-evloop-dev', |
81 | 'liblmdb-dev', | |
ff4c1303 | 82 | 'libnghttp2-dev', |
99bb3530 PD |
83 | 'libre2-dev', |
84 | 'libsnmp-dev', | |
85 | ] | |
c184b26a RG |
86 | dnsdist_xdp_build_deps = [ |
87 | 'libbpf-dev', | |
88 | 'libxdp-dev', | |
89 | ] | |
99bb3530 PD |
90 | auth_test_deps = [ # FIXME: we should be generating some of these from shlibdeps in build |
91 | 'authbind', | |
92 | 'bc', | |
93 | 'bind9utils', | |
94 | 'curl', | |
95 | 'default-jre-headless', | |
96 | 'dnsutils', | |
222d17e2 | 97 | 'faketime', |
99bb3530 | 98 | 'gawk', |
bb4f68fd | 99 | 'krb5-user', |
99bb3530 | 100 | 'ldnsutils', |
7d862cb3 | 101 | '"libboost-serialization1.7[1-9]+"', |
99bb3530 PD |
102 | 'libcdb1', |
103 | 'libcurl4', | |
104 | 'libgeoip1', | |
105 | 'libkrb5-3', | |
b69425da | 106 | '"libldap-2.[1-9]+"', |
99bb3530 PD |
107 | 'liblmdb0', |
108 | 'libluajit-5.1-2', | |
109 | 'libmaxminddb0', | |
110 | 'libnet-dns-perl', | |
111 | 'libp11-kit0', | |
112 | 'libpq5', | |
113 | 'libsodium23', | |
114 | 'libsqlite3-dev', | |
99bb3530 | 115 | 'libsystemd0', |
b69425da | 116 | '"libyaml-cpp0.[1-9]+"', |
99bb3530 | 117 | 'libzmq3-dev', |
3a52d52f | 118 | 'lmdb-utils', |
7c05901b | 119 | 'prometheus', |
0e77de07 PD |
120 | 'ruby-bundler', |
121 | 'ruby-dev', | |
99bb3530 PD |
122 | 'socat', |
123 | 'softhsm2', | |
124 | 'unbound-host', | |
125 | 'unixodbc', | |
869fc2b5 | 126 | 'wget', |
99bb3530 | 127 | ] |
e8d83f88 FM |
128 | doc_deps = [ |
129 | 'autoconf', | |
130 | 'automake', | |
131 | 'bison', | |
132 | 'curl', | |
133 | 'flex', | |
134 | 'g++', | |
135 | 'git', | |
136 | 'latexmk', | |
137 | 'libboost-all-dev', | |
138 | 'libedit-dev', | |
139 | 'libluajit-5.1-dev', | |
140 | 'libssl-dev', | |
141 | 'make', | |
142 | 'pkg-config', | |
143 | 'python3-venv', | |
144 | 'ragel', | |
145 | 'rsync', | |
146 | ] | |
147 | doc_deps_pdf = [ | |
148 | 'texlive-binaries', | |
149 | 'texlive-formats-extra', | |
150 | 'texlive-latex-extra', | |
151 | ] | |
99bb3530 PD |
152 | |
153 | @task | |
154 | def apt_fresh(c): | |
155 | c.sudo('apt-get update') | |
699d088a | 156 | c.sudo('apt-get -y --allow-downgrades dist-upgrade') |
99bb3530 PD |
157 | |
158 | @task | |
159 | def install_clang(c): | |
160 | """ | |
7d862cb3 | 161 | install clang and llvm |
99bb3530 | 162 | """ |
7d862cb3 | 163 | c.sudo(f'apt-get -y --no-install-recommends install clang-{clang_version} llvm-{clang_version}') |
99bb3530 | 164 | |
fae3e64c FM |
165 | @task |
166 | def install_clang_tidy_tools(c): | |
7d862cb3 | 167 | c.sudo(f'apt-get -y --no-install-recommends install clang-tidy-{clang_version} clang-tools-{clang_version} bear python3-yaml') |
fae3e64c | 168 | |
99bb3530 PD |
169 | @task |
170 | def install_clang_runtime(c): | |
171 | # this gives us the symbolizer, for symbols in asan/ubsan traces | |
7d862cb3 | 172 | c.sudo(f'apt-get -y --no-install-recommends install clang-{clang_version}') |
99bb3530 | 173 | |
9883d3f9 OM |
174 | @task |
175 | def ci_install_rust(c, repo): | |
4ccb0f78 RG |
176 | with c.cd(f'{repo}/builder-support/helpers/'): |
177 | c.run('sudo sh install_rust.sh') | |
9883d3f9 | 178 | |
d1c1159f FM |
179 | def install_libdecaf(c, product): |
180 | c.run('git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf') | |
181 | with c.cd('/tmp/libdecaf'): | |
182 | c.run('git checkout 41f349') | |
2ef73ca0 | 183 | c.run(f'CC={get_c_compiler()} CXX={get_cxx_compiler()} ' |
9466b8e6 | 184 | 'cmake -B build ' |
d1c1159f FM |
185 | '-DCMAKE_INSTALL_PREFIX=/usr/local ' |
186 | '-DCMAKE_INSTALL_LIBDIR=lib ' | |
187 | '-DENABLE_STATIC=OFF ' | |
188 | '-DENABLE_TESTS=OFF ' | |
189 | '-DCMAKE_C_FLAGS="-Wno-sizeof-array-div -Wno-array-parameter" .') | |
190 | c.run('make -C build') | |
191 | c.run('sudo make -C build install') | |
192 | c.sudo(f'mkdir -p /opt/{product}/libdecaf') | |
193 | c.sudo(f'cp /usr/local/lib/libdecaf.so* /opt/{product}/libdecaf/.') | |
194 | ||
e8d83f88 FM |
195 | @task |
196 | def install_doc_deps(c): | |
699d088a | 197 | c.sudo('apt-get install -y ' + ' '.join(doc_deps)) |
e8d83f88 FM |
198 | |
199 | @task | |
200 | def install_doc_deps_pdf(c): | |
699d088a | 201 | c.sudo('apt-get install -y ' + ' '.join(doc_deps_pdf)) |
e8d83f88 | 202 | |
99bb3530 PD |
203 | @task |
204 | def install_auth_build_deps(c): | |
699d088a | 205 | c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + auth_build_deps)) |
825560a1 RG |
206 | if os.getenv('DECAF_SUPPORT', 'no') == 'yes': |
207 | install_libdecaf(c, 'pdns-auth') | |
99bb3530 | 208 | |
628a1dec RG |
209 | def is_coverage_enabled(): |
210 | sanitizers = os.getenv('SANITIZERS') | |
211 | if sanitizers: | |
212 | sanitizers = sanitizers.split('+') | |
213 | if 'tsan' in sanitizers: | |
214 | return False | |
215 | return os.getenv('COVERAGE') == 'yes' | |
216 | ||
7146a45a RG |
217 | def get_coverage(): |
218 | return '--enable-coverage=clang' if is_coverage_enabled() else '' | |
219 | ||
628a1dec RG |
220 | @task |
221 | def install_coverage_deps(c): | |
222 | if is_coverage_enabled(): | |
223 | c.sudo(f'apt-get install -y --no-install-recommends llvm-{clang_version}') | |
224 | ||
225 | @task | |
226 | def generate_coverage_info(c, binary, outputDir): | |
227 | if is_coverage_enabled(): | |
228 | version = os.getenv('BUILDER_VERSION') | |
229 | c.run(f'llvm-profdata-{clang_version} merge -sparse -o {outputDir}/temp.profdata /tmp/code-*.profraw') | |
230 | c.run(f'llvm-cov-{clang_version} export --format=lcov --ignore-filename-regex=\'^/usr/\' -instr-profile={outputDir}/temp.profdata -object {binary} > {outputDir}/coverage.lcov') | |
231 | c.run(f'{outputDir}/.github/scripts/normalize_paths_in_coverage.py {outputDir} {version} {outputDir}/coverage.lcov {outputDir}/normalized_coverage.lcov') | |
232 | c.run(f'mv {outputDir}/normalized_coverage.lcov {outputDir}/coverage.lcov') | |
233 | ||
99bb3530 PD |
234 | def setup_authbind(c): |
235 | c.sudo('touch /etc/authbind/byport/53') | |
236 | c.sudo('chmod 755 /etc/authbind/byport/53') | |
237 | ||
238 | auth_backend_test_deps = dict( | |
239 | gsqlite3=['sqlite3'], | |
240 | gmysql=['default-libmysqlclient-dev'], | |
241 | gpgsql=['libpq-dev'], | |
0e77de07 | 242 | lmdb=[], |
b33a88da PD |
243 | remote=[], |
244 | bind=[], | |
245 | geoip=[], | |
246 | lua2=[], | |
222d17e2 | 247 | tinydns=[], |
8af54cc6 AR |
248 | authpy=[], |
249 | godbc_sqlite3=['libsqliteodbc'], | |
c4a7e1df AR |
250 | godbc_mssql=['freetds-bin','tdsodbc'], |
251 | ldap=[], | |
252 | geoip_mmdb=[] | |
99bb3530 PD |
253 | ) |
254 | ||
255 | @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable=['backend'], optional=['backend']) | |
256 | def install_auth_test_deps(c, backend): # FIXME: rename this, we do way more than apt-get | |
257 | extra=[] | |
258 | for b in backend: | |
259 | extra.extend(auth_backend_test_deps[b]) | |
7d862cb3 | 260 | c.sudo('DEBIAN_FRONTEND=noninteractive apt-get -y install ' + ' '.join(extra+auth_test_deps)) |
99bb3530 PD |
261 | |
262 | c.run('chmod +x /opt/pdns-auth/bin/* /opt/pdns-auth/sbin/*') | |
263 | # c.run('''if [ ! -e $HOME/bin/jdnssec-verifyzone ]; then | |
264 | # wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz | |
265 | # tar xfz jdnssec-tools-0.14.tar.gz -C $HOME | |
266 | # rm jdnssec-tools-0.14.tar.gz | |
267 | # fi | |
268 | # echo 'export PATH=$HOME/jdnssec-tools-0.14/bin:$PATH' >> $BASH_ENV''') # FIXME: why did this fail with no error? | |
222d17e2 PD |
269 | c.run('touch regression-tests/tests/verify-dnssec-zone/allow-missing regression-tests.nobackend/rectify-axfr/allow-missing') # FIXME: can this go? |
270 | # FIXME we may want to start a background recursor here to make ALIAS tests more robust | |
99bb3530 PD |
271 | setup_authbind(c) |
272 | ||
825560a1 RG |
273 | if os.getenv('DECAF_SUPPORT', 'no') == 'yes': |
274 | # Copy libdecaf out | |
275 | c.sudo('mkdir -p /usr/local/lib') | |
276 | c.sudo('cp /opt/pdns-auth/libdecaf/libdecaf.so* /usr/local/lib/.') | |
d1c1159f | 277 | |
4467dd85 O |
278 | @task |
279 | def install_rec_bulk_deps(c): # FIXME: rename this, we do way more than apt-get | |
699d088a | 280 | c.sudo('apt-get --no-install-recommends -y install ' + ' '.join(rec_bulk_deps)) |
4467dd85 O |
281 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') |
282 | ||
99bb3530 PD |
283 | @task |
284 | def install_rec_test_deps(c): # FIXME: rename this, we do way more than apt-get | |
699d088a | 285 | c.sudo('apt-get --no-install-recommends install -y ' + ' '.join(rec_bulk_deps) + ' \ |
4467dd85 O |
286 | pdns-server pdns-backend-bind daemontools \ |
287 | jq libfaketime lua-posix lua-socket bc authbind \ | |
6b45d67b | 288 | python3-venv python3-dev default-libmysqlclient-dev libpq-dev \ |
4467dd85 | 289 | protobuf-compiler snmpd prometheus') |
99bb3530 PD |
290 | |
291 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
292 | ||
293 | setup_authbind(c) | |
294 | ||
6b45d67b | 295 | c.run('sed "s/agentxperms 0700 0755 recursor/agentxperms 0777 0755/g" regression-tests.recursor-dnssec/snmpd.conf | sudo tee /etc/snmp/snmpd.conf') |
7d862cb3 | 296 | c.sudo('/etc/init.d/snmpd restart') |
6b45d67b O |
297 | time.sleep(5) |
298 | c.sudo('chmod 755 /var/agentx') | |
299 | ||
f941004d RG |
300 | @task(optional=['skipXDP']) |
301 | def install_dnsdist_test_deps(c, skipXDP=False): # FIXME: rename this, we do way more than apt-get | |
c184b26a RG |
302 | deps = 'libluajit-5.1-2 \ |
303 | libboost-all-dev \ | |
304 | libcap2 \ | |
305 | libcdb1 \ | |
306 | libcurl4-openssl-dev \ | |
307 | libfstrm0 \ | |
308 | libgnutls30 \ | |
309 | libh2o-evloop0.13 \ | |
310 | liblmdb0 \ | |
311 | libnghttp2-14 \ | |
312 | "libre2-[1-9]+" \ | |
313 | libssl-dev \ | |
314 | libsystemd0 \ | |
315 | libsodium23 \ | |
316 | lua-socket \ | |
317 | patch \ | |
318 | protobuf-compiler \ | |
319 | python3-venv snmpd prometheus' | |
f941004d RG |
320 | if not skipXDP: |
321 | deps = deps + '\ | |
322 | libbpf1 \ | |
c184b26a RG |
323 | libxdp1' |
324 | ||
325 | c.sudo(f'apt-get install -y {deps}') | |
99bb3530 | 326 | c.run('sed "s/agentxperms 0700 0755 dnsdist/agentxperms 0777 0755/g" regression-tests.dnsdist/snmpd.conf | sudo tee /etc/snmp/snmpd.conf') |
7d862cb3 | 327 | c.sudo('/etc/init.d/snmpd restart') |
99bb3530 PD |
328 | time.sleep(5) |
329 | c.sudo('chmod 755 /var/agentx') | |
330 | ||
331 | @task | |
332 | def install_rec_build_deps(c): | |
699d088a | 333 | c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + rec_build_deps)) |
99bb3530 | 334 | |
c184b26a RG |
335 | @task(optional=['skipXDP']) |
336 | def install_dnsdist_build_deps(c, skipXDP=False): | |
f941004d | 337 | c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + dnsdist_build_deps + (dnsdist_xdp_build_deps if not skipXDP else []))) |
99bb3530 PD |
338 | |
339 | @task | |
340 | def ci_autoconf(c): | |
e917c86b | 341 | c.run('autoreconf -vfi') |
99bb3530 | 342 | |
fdcc46e4 OM |
343 | @task |
344 | def ci_docs_rec_generate(c): | |
345 | c.run('python3 generate.py') | |
346 | ||
e8d83f88 FM |
347 | @task |
348 | def ci_docs_build(c): | |
349 | c.run('make -f Makefile.sphinx -C docs html') | |
350 | ||
351 | @task | |
352 | def ci_docs_build_pdf(c): | |
353 | c.run('make -f Makefile.sphinx -C docs latexpdf') | |
354 | ||
355 | @task | |
e0ec64f1 | 356 | def ci_docs_upload_master(c, docs_host, pdf, username, product, directory=""): |
5d9b131b FM |
357 | rsync_cmd = " ".join([ |
358 | "rsync", | |
359 | "--checksum", | |
360 | "--recursive", | |
361 | "--verbose", | |
362 | "--no-p", | |
363 | "--chmod=g=rwX", | |
364 | "--exclude '*~'", | |
365 | ]) | |
366 | c.run(f"{rsync_cmd} --delete ./docs/_build/{product}-html-docs/ {username}@{docs_host}:{directory}") | |
367 | c.run(f"{rsync_cmd} ./docs/_build/{product}-html-docs.tar.bz2 {username}@{docs_host}:{directory}/html-docs.tar.bz2") | |
368 | c.run(f"{rsync_cmd} ./docs/_build/latex/{pdf} {username}@{docs_host}:{directory}") | |
e8d83f88 FM |
369 | |
370 | @task | |
371 | def ci_docs_add_ssh(c, ssh_key, host_key): | |
372 | c.run('mkdir -m 700 -p ~/.ssh') | |
373 | c.run(f'echo "{ssh_key}" > ~/.ssh/id_ed25519') | |
374 | c.run('chmod 600 ~/.ssh/id_ed25519') | |
375 | c.run(f'echo "{host_key}" > ~/.ssh/known_hosts') | |
376 | ||
8804bc1d FM |
377 | |
378 | def get_sanitizers(): | |
35859c0b | 379 | sanitizers = os.getenv('SANITIZERS', '') |
8804bc1d FM |
380 | if sanitizers != '': |
381 | sanitizers = sanitizers.split('+') | |
382 | sanitizers = ['--enable-' + sanitizer for sanitizer in sanitizers] | |
383 | sanitizers = ' '.join(sanitizers) | |
384 | return sanitizers | |
385 | ||
7146a45a RG |
386 | def get_unit_tests(auth=False): |
387 | if os.getenv('UNIT_TESTS') != 'yes': | |
388 | return '' | |
389 | return '--enable-unit-tests --enable-backend-unit-tests' if auth else '--enable-unit-tests' | |
390 | ||
391 | def get_build_concurrency(default=8): | |
392 | return os.getenv('CONCURRENCY', default) | |
393 | ||
394 | def get_fuzzing_targets(): | |
395 | return '--enable-fuzz-targets' if os.getenv('FUZZING_TARGETS') == 'yes' else '' | |
396 | ||
397 | def is_compiler_clang(): | |
c6034e81 | 398 | compiler = os.getenv('COMPILER', 'clang') |
7146a45a RG |
399 | return compiler == 'clang' |
400 | ||
401 | def get_c_compiler(): | |
402 | return f'clang-{clang_version}' if is_compiler_clang() else 'gcc' | |
2ef73ca0 RG |
403 | |
404 | def get_cxx_compiler(): | |
7146a45a | 405 | return f'clang++-{clang_version}' if is_compiler_clang() else 'g++' |
2ef73ca0 RG |
406 | |
407 | def get_optimizations(): | |
472404b9 RG |
408 | optimizations = os.getenv('OPTIMIZATIONS', 'yes') |
409 | return '-O1' if optimizations == 'yes' else '-O0' | |
8804bc1d FM |
410 | |
411 | def get_cflags(): | |
412 | return " ".join([ | |
2ef73ca0 | 413 | get_optimizations(), |
8804bc1d FM |
414 | "-Werror=vla", |
415 | "-Werror=shadow", | |
416 | "-Wformat=2", | |
417 | "-Werror=format-security", | |
11c5018a RG |
418 | "-fstack-clash-protection", |
419 | "-fstack-protector-strong", | |
420 | "-fcf-protection=full", | |
7146a45a | 421 | "-Werror=string-plus-int" if is_compiler_clang() else '', |
8804bc1d FM |
422 | ]) |
423 | ||
424 | ||
425 | def get_cxxflags(): | |
426 | return " ".join([ | |
427 | get_cflags(), | |
428 | "-Wp,-D_GLIBCXX_ASSERTIONS", | |
429 | ]) | |
430 | ||
431 | ||
7146a45a RG |
432 | def get_base_configure_cmd(additional_c_flags='', additional_cxx_flags='', enable_systemd=True, enable_sodium=True): |
433 | cflags = " ".join([get_cflags(), additional_c_flags]) | |
434 | cxxflags = " ".join([get_cxxflags(), additional_cxx_flags]) | |
8804bc1d | 435 | return " ".join([ |
7146a45a RG |
436 | f'CFLAGS="{cflags}"', |
437 | f'CXXFLAGS="{cxxflags}"', | |
8804bc1d | 438 | './configure', |
2ef73ca0 RG |
439 | f"CC='{get_c_compiler()}'", |
440 | f"CXX='{get_cxx_compiler()}'", | |
8804bc1d | 441 | "--enable-option-checking=fatal", |
7146a45a RG |
442 | "--enable-systemd" if enable_systemd else '', |
443 | "--with-libsodium" if enable_sodium else '', | |
8804bc1d FM |
444 | "--enable-fortify-source=auto", |
445 | "--enable-auto-var-init=pattern", | |
7146a45a RG |
446 | get_coverage(), |
447 | get_sanitizers() | |
8804bc1d FM |
448 | ]) |
449 | ||
450 | ||
99bb3530 PD |
451 | @task |
452 | def ci_auth_configure(c): | |
7146a45a RG |
453 | unittests = get_unit_tests(True) |
454 | fuzz_targets = get_fuzzing_targets() | |
8804bc1d FM |
455 | modules = " ".join([ |
456 | "bind", | |
457 | "geoip", | |
458 | "gmysql", | |
459 | "godbc", | |
460 | "gpgsql", | |
461 | "gsqlite3", | |
462 | "ldap", | |
463 | "lmdb", | |
464 | "lua2", | |
465 | "pipe", | |
466 | "remote", | |
467 | "tinydns", | |
468 | ]) | |
469 | configure_cmd = " ".join([ | |
470 | get_base_configure_cmd(), | |
471 | "LDFLAGS='-L/usr/local/lib -Wl,-rpath,/usr/local/lib'", | |
472 | f"--with-modules='{modules}'", | |
473 | "--enable-tools", | |
2ef73ca0 | 474 | "--enable-dns-over-tls", |
8804bc1d FM |
475 | "--enable-experimental-pkcs11", |
476 | "--enable-experimental-gss-tsig", | |
477 | "--enable-remotebackend-zeromq", | |
9a299f9d | 478 | "--enable-verbose-logging", |
8804bc1d | 479 | "--with-lmdb=/usr", |
825560a1 | 480 | "--with-libdecaf" if os.getenv('DECAF_SUPPORT', 'no') == 'yes' else '', |
8804bc1d FM |
481 | "--prefix=/opt/pdns-auth", |
482 | "--enable-ixfrdist", | |
8804bc1d | 483 | unittests, |
7146a45a | 484 | fuzz_targets |
8804bc1d FM |
485 | ]) |
486 | res = c.run(configure_cmd, warn=True) | |
99bb3530 PD |
487 | if res.exited != 0: |
488 | c.run('cat config.log') | |
489 | raise UnexpectedExit(res) | |
8804bc1d FM |
490 | |
491 | ||
99bb3530 | 492 | @task |
dc46a028 | 493 | def ci_rec_configure(c, features): |
7146a45a | 494 | unittests = get_unit_tests() |
8804bc1d | 495 | |
dc46a028 OM |
496 | if features == 'full': |
497 | configure_cmd = " ".join([ | |
498 | get_base_configure_cmd(), | |
499 | "--prefix=/opt/pdns-recursor", | |
500 | "--enable-option-checking", | |
501 | "--enable-verbose-logging", | |
502 | "--enable-dns-over-tls", | |
503 | "--enable-nod", | |
504 | "--with-libcap", | |
505 | "--with-lua=luajit", | |
506 | "--with-net-snmp", | |
507 | unittests, | |
508 | ]) | |
509 | else: | |
510 | configure_cmd = " ".join([ | |
511 | get_base_configure_cmd(), | |
512 | "--prefix=/opt/pdns-recursor", | |
513 | "--enable-option-checking", | |
514 | "--enable-verbose-logging", | |
515 | "--disable-dns-over-tls", | |
516 | "--disable-dnstap", | |
517 | "--disable-nod", | |
518 | "--disable-systemd", | |
519 | "--with-lua=luajit", | |
520 | "--without-libcap", | |
521 | "--without-libcurl", | |
522 | "--without-libdecaf", | |
523 | "--without-libsodium", | |
524 | "--without-net-snmp", | |
525 | unittests, | |
526 | ]) | |
8804bc1d | 527 | res = c.run(configure_cmd, warn=True) |
99bb3530 PD |
528 | if res.exited != 0: |
529 | c.run('cat config.log') | |
530 | raise UnexpectedExit(res) | |
531 | ||
8804bc1d | 532 | |
99bb3530 | 533 | @task |
e3d6cf05 RG |
534 | def ci_dnsdist_configure(c, features): |
535 | additional_flags = '' | |
536 | if features == 'full': | |
537 | features_set = '--enable-dnstap \ | |
538 | --enable-dnscrypt \ | |
539 | --enable-dns-over-tls \ | |
540 | --enable-dns-over-https \ | |
3e5c7a76 | 541 | --enable-dns-over-quic \ |
d1f77ae6 | 542 | --enable-dns-over-http3 \ |
e3d6cf05 RG |
543 | --enable-systemd \ |
544 | --prefix=/opt/dnsdist \ | |
545 | --with-gnutls \ | |
f31d8bad | 546 | --with-h2o \ |
e3d6cf05 RG |
547 | --with-libsodium \ |
548 | --with-lua=luajit \ | |
549 | --with-libcap \ | |
d5d26f84 | 550 | --with-net-snmp \ |
e3d6cf05 | 551 | --with-nghttp2 \ |
7146a45a | 552 | --with-re2' |
e3d6cf05 RG |
553 | else: |
554 | features_set = '--disable-dnstap \ | |
555 | --disable-dnscrypt \ | |
556 | --disable-ipcipher \ | |
557 | --disable-systemd \ | |
558 | --without-cdb \ | |
559 | --without-ebpf \ | |
560 | --without-gnutls \ | |
f31d8bad | 561 | --without-h2o \ |
e3d6cf05 RG |
562 | --without-libedit \ |
563 | --without-libsodium \ | |
564 | --without-lmdb \ | |
565 | --without-net-snmp \ | |
6135a84e | 566 | --without-nghttp2 \ |
7146a45a | 567 | --without-re2' |
e3d6cf05 | 568 | additional_flags = '-DDISABLE_COMPLETION \ |
6b6f0aa6 RG |
569 | -DDISABLE_DELAY_PIPE \ |
570 | -DDISABLE_DYNBLOCKS \ | |
e3d6cf05 RG |
571 | -DDISABLE_PROMETHEUS \ |
572 | -DDISABLE_PROTOBUF \ | |
573 | -DDISABLE_BUILTIN_HTML \ | |
574 | -DDISABLE_CARBON \ | |
575 | -DDISABLE_SECPOLL \ | |
576 | -DDISABLE_DEPRECATED_DYNBLOCK \ | |
577 | -DDISABLE_LUA_WEB_HANDLERS \ | |
578 | -DDISABLE_NON_FFI_DQ_BINDINGS \ | |
579 | -DDISABLE_POLICIES_BINDINGS \ | |
580 | -DDISABLE_PACKETCACHE_BINDINGS \ | |
581 | -DDISABLE_DOWNSTREAM_BINDINGS \ | |
582 | -DDISABLE_COMBO_ADDR_BINDINGS \ | |
583 | -DDISABLE_CLIENT_STATE_BINDINGS \ | |
584 | -DDISABLE_QPS_LIMITER_BINDINGS \ | |
585 | -DDISABLE_SUFFIX_MATCH_BINDINGS \ | |
586 | -DDISABLE_NETMASK_BINDINGS \ | |
587 | -DDISABLE_DNSNAME_BINDINGS \ | |
588 | -DDISABLE_DNSHEADER_BINDINGS \ | |
589 | -DDISABLE_RECVMMSG \ | |
85241b78 | 590 | -DDISABLE_WEB_CACHE_MANAGEMENT \ |
e3d6cf05 RG |
591 | -DDISABLE_WEB_CONFIG \ |
592 | -DDISABLE_RULES_ALTERING_QUERIES \ | |
593 | -DDISABLE_ECS_ACTIONS \ | |
dbefe674 RG |
594 | -DDISABLE_TOP_N_BINDINGS \ |
595 | -DDISABLE_OCSP_STAPLING \ | |
596 | -DDISABLE_HASHED_CREDENTIALS \ | |
597 | -DDISABLE_FALSE_SHARING_PADDING \ | |
598 | -DDISABLE_NPN' | |
7146a45a RG |
599 | unittests = get_unit_tests() |
600 | fuzztargets = get_fuzzing_targets() | |
601 | tools = f'''AR=llvm-ar-{clang_version} RANLIB=llvm-ranlib-{clang_version}''' if is_compiler_clang() else '' | |
602 | configure_cmd = " ".join([ | |
603 | tools, | |
604 | get_base_configure_cmd(additional_c_flags='', additional_cxx_flags=additional_flags, enable_systemd=False, enable_sodium=False), | |
605 | features_set, | |
606 | unittests, | |
607 | fuzztargets, | |
6e8e1c43 | 608 | '--enable-lto=thin', |
7146a45a RG |
609 | '--prefix=/opt/dnsdist' |
610 | ]) | |
611 | ||
612 | res = c.run(configure_cmd, warn=True) | |
99bb3530 PD |
613 | if res.exited != 0: |
614 | c.run('cat config.log') | |
615 | raise UnexpectedExit(res) | |
616 | ||
617 | @task | |
618 | def ci_auth_make(c): | |
7146a45a | 619 | c.run(f'make -j{get_build_concurrency()} -k V=1') |
99bb3530 | 620 | |
fae3e64c FM |
621 | @task |
622 | def ci_auth_make_bear(c): | |
7146a45a | 623 | c.run(f'bear --append -- make -j{get_build_concurrency()} -k V=1') |
fae3e64c | 624 | |
99bb3530 PD |
625 | @task |
626 | def ci_rec_make(c): | |
7146a45a | 627 | c.run(f'make -j{get_build_concurrency()} -k V=1') |
99bb3530 | 628 | |
f01e3a4a FM |
629 | @task |
630 | def ci_rec_make_bear(c): | |
631 | # Assumed to be running under ./pdns/recursordist/ | |
7146a45a | 632 | c.run(f'bear --append -- make -j{get_build_concurrency()} -k V=1') |
f01e3a4a | 633 | |
99bb3530 PD |
634 | @task |
635 | def ci_dnsdist_make(c): | |
7146a45a | 636 | c.run(f'make -j{get_build_concurrency(4)} -k V=1') |
99bb3530 | 637 | |
97145bb4 FM |
638 | @task |
639 | def ci_dnsdist_make_bear(c): | |
640 | # Assumed to be running under ./pdns/dnsdistdist/ | |
7146a45a | 641 | c.run(f'bear --append -- make -j{get_build_concurrency(4)} -k V=1') |
97145bb4 | 642 | |
99bb3530 | 643 | @task |
e55d3a4b | 644 | def ci_auth_install_remotebackend_test_deps(c): |
99bb3530 | 645 | with c.cd('modules/remotebackend'): |
0e77de07 PD |
646 | # c.run('bundle config set path vendor/bundle') |
647 | c.run('sudo ruby -S bundle install') | |
699d088a | 648 | c.sudo('apt-get install -y socat') |
99bb3530 PD |
649 | |
650 | @task | |
651 | def ci_auth_run_unit_tests(c): | |
652 | res = c.run('make check', warn=True) | |
653 | if res.exited != 0: | |
222d17e2 PD |
654 | c.run('cat pdns/test-suite.log', warn=True) |
655 | c.run('cat modules/remotebackend/test-suite.log', warn=True) | |
99bb3530 PD |
656 | raise UnexpectedExit(res) |
657 | ||
658 | @task | |
659 | def ci_rec_run_unit_tests(c): | |
660 | res = c.run('make check', warn=True) | |
661 | if res.exited != 0: | |
662 | c.run('cat test-suite.log') | |
663 | raise UnexpectedExit(res) | |
664 | ||
665 | @task | |
666 | def ci_dnsdist_run_unit_tests(c): | |
667 | res = c.run('make check', warn=True) | |
668 | if res.exited != 0: | |
669 | c.run('cat test-suite.log') | |
670 | raise UnexpectedExit(res) | |
671 | ||
e917c86b AR |
672 | @task |
673 | def ci_make_distdir(c): | |
674 | res = c.run('make distdir') | |
675 | ||
99bb3530 PD |
676 | @task |
677 | def ci_make_install(c): | |
678 | res = c.run('make install') # FIXME: this builds auth docs - again | |
679 | ||
680 | @task | |
7d862cb3 | 681 | def add_auth_repo(c, dist_name, dist_release_name, pdns_repo_version): |
699d088a | 682 | c.sudo('apt-get install -y curl gnupg2') |
7d862cb3 | 683 | if pdns_repo_version == 'master': |
99bb3530 PD |
684 | c.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/CBC8B383-pub.asc') |
685 | else: | |
686 | c.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/FD380FBB-pub.asc') | |
7d862cb3 | 687 | c.run(f"echo 'deb [arch=amd64] http://repo.powerdns.com/{dist_name} {dist_release_name}-auth-{pdns_repo_version} main' | sudo tee /etc/apt/sources.list.d/pdns.list") |
99bb3530 PD |
688 | c.run("echo 'Package: pdns-*' | sudo tee /etc/apt/preferences.d/pdns") |
689 | c.run("echo 'Pin: origin repo.powerdns.com' | sudo tee -a /etc/apt/preferences.d/pdns") | |
690 | c.run("echo 'Pin-Priority: 600' | sudo tee -a /etc/apt/preferences.d/pdns") | |
691 | c.sudo('apt-get update') | |
692 | ||
693 | @task | |
694 | def test_api(c, product, backend=''): | |
695 | if product == 'recursor': | |
696 | with c.cd('regression-tests.api'): | |
697 | c.run(f'PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor ./runtests recursor {backend}') | |
698 | elif product == 'auth': | |
699 | with c.cd('regression-tests.api'): | |
7d862cb3 | 700 | c.run(f'PDNSSERVER=/opt/pdns-auth/sbin/pdns_server PDNSUTIL=/opt/pdns-auth/bin/pdnsutil SDIG=/opt/pdns-auth/bin/sdig MYSQL_HOST={auth_backend_ip_addr} PGHOST={auth_backend_ip_addr} PGPORT=5432 ./runtests authoritative {backend}') |
99bb3530 PD |
701 | else: |
702 | raise Failure('unknown product') | |
703 | ||
0e77de07 | 704 | backend_regress_tests = dict( |
b33a88da | 705 | bind = [ |
8af54cc6 AR |
706 | 'bind-both', |
707 | 'bind-dnssec-both', | |
708 | 'bind-dnssec-nsec3-both', | |
709 | 'bind-dnssec-nsec3-optout-both', | |
710 | 'bind-dnssec-nsec3-narrow', | |
57d9ffa8 | 711 | 'bind-dnssec-pkcs11' |
b33a88da PD |
712 | ], |
713 | geoip = [ | |
8af54cc6 AR |
714 | 'geoip', |
715 | 'geoip-nsec3-narrow' | |
b33a88da | 716 | ], |
8af54cc6 AR |
717 | lua2 = ['lua2', 'lua2-dnssec'], |
718 | tinydns = ['tinydns'], | |
b33a88da | 719 | remote = [ |
8af54cc6 AR |
720 | 'remotebackend-pipe', |
721 | 'remotebackend-unix', | |
722 | 'remotebackend-http', | |
723 | 'remotebackend-zeromq', | |
724 | 'remotebackend-pipe-dnssec', | |
725 | 'remotebackend-unix-dnssec', | |
726 | 'remotebackend-http-dnssec', | |
727 | 'remotebackend-zeromq-dnssec' | |
b33a88da PD |
728 | ], |
729 | lmdb = [ | |
8af54cc6 AR |
730 | 'lmdb-nodnssec-both', |
731 | 'lmdb-both', | |
732 | 'lmdb-nsec3-both', | |
733 | 'lmdb-nsec3-optout-both', | |
734 | 'lmdb-nsec3-narrow' | |
735 | ], | |
736 | gmysql = [ | |
737 | 'gmysql', | |
738 | 'gmysql-nodnssec-both', | |
739 | 'gmysql-nsec3-both', | |
740 | 'gmysql-nsec3-optout-both', | |
741 | 'gmysql-nsec3-narrow', | |
742 | 'gmysql_sp-both' | |
743 | ], | |
744 | gpgsql = [ | |
745 | 'gpgsql', | |
746 | 'gpgsql-nodnssec-both', | |
747 | 'gpgsql-nsec3-both', | |
748 | 'gpgsql-nsec3-optout-both', | |
749 | 'gpgsql-nsec3-narrow', | |
750 | 'gpgsql_sp-both' | |
751 | ], | |
752 | gsqlite3 = [ | |
753 | 'gsqlite3', | |
754 | 'gsqlite3-nodnssec-both', | |
755 | 'gsqlite3-nsec3-both', | |
756 | 'gsqlite3-nsec3-optout-both', | |
757 | 'gsqlite3-nsec3-narrow' | |
758 | ], | |
759 | godbc_sqlite3 = ['godbc_sqlite3-nodnssec'], | |
760 | godbc_mssql = [ | |
761 | 'godbc_mssql', | |
762 | 'godbc_mssql-nodnssec', | |
763 | 'godbc_mssql-nsec3', | |
764 | 'godbc_mssql-nsec3-optout', | |
765 | 'godbc_mssql-nsec3-narrow' | |
b33a88da | 766 | ], |
c4a7e1df AR |
767 | ldap = [ |
768 | 'ldap-tree', | |
769 | 'ldap-simple', | |
770 | 'ldap-strict' | |
771 | ], | |
772 | geoip_mmdb = ['geoip'], | |
0e77de07 PD |
773 | ) |
774 | ||
b47c41d1 | 775 | godbc_mssql_credentials = {"username": "sa", "password": "SAsa12%%-not-a-secret-password"} |
8af54cc6 | 776 | |
7d862cb3 | 777 | godbc_config = f''' |
8af54cc6 AR |
778 | [pdns-mssql-docker] |
779 | Driver=FreeTDS | |
780 | Trace=No | |
7d862cb3 | 781 | Server={auth_backend_ip_addr} |
8af54cc6 AR |
782 | Port=1433 |
783 | Database=pdns | |
784 | TDS_Version=7.1 | |
785 | ||
786 | [pdns-mssql-docker-nodb] | |
787 | Driver=FreeTDS | |
788 | Trace=No | |
7d862cb3 | 789 | Server={auth_backend_ip_addr} |
8af54cc6 AR |
790 | Port=1433 |
791 | TDS_Version=7.1 | |
792 | ||
793 | [pdns-sqlite3-1] | |
794 | Driver = SQLite3 | |
795 | Database = pdns.sqlite3 | |
796 | ||
797 | [pdns-sqlite3-2] | |
798 | Driver = SQLite3 | |
799 | Database = pdns.sqlite32 | |
800 | ''' | |
801 | ||
802 | def setup_godbc_mssql(c): | |
803 | with open(os.path.expanduser("~/.odbc.ini"), "a") as f: | |
804 | f.write(godbc_config) | |
805 | c.sudo('sh -c \'echo "Threading=1" | cat /usr/share/tdsodbc/odbcinst.ini - | tee -a /etc/odbcinst.ini\'') | |
806 | c.sudo('sed -i "s/libtdsodbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libtdsodbc.so/g" /etc/odbcinst.ini') | |
807 | c.run(f'echo "create database pdns" | isql -v pdns-mssql-docker-nodb {godbc_mssql_credentials["username"]} {godbc_mssql_credentials["password"]}') | |
808 | # FIXME: Skip 8bit-txt-unescaped test | |
809 | c.run('touch ${PWD}/regression-tests/tests/8bit-txt-unescaped/skip') | |
810 | ||
811 | def setup_godbc_sqlite3(c): | |
812 | with open(os.path.expanduser("~/.odbc.ini"), "a") as f: | |
813 | f.write(godbc_config) | |
814 | c.sudo('sed -i "s/libsqlite3odbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libsqlite3odbc.so/g" /etc/odbcinst.ini') | |
815 | ||
c4a7e1df | 816 | def setup_ldap_client(c): |
699d088a | 817 | c.sudo('DEBIAN_FRONTEND=noninteractive apt-get install -y ldap-utils') |
7d862cb3 | 818 | c.sudo(f'sh -c \'echo "{auth_backend_ip_addr} ldapserver" | tee -a /etc/hosts\'') |
c4a7e1df | 819 | |
57d9ffa8 | 820 | def setup_softhsm(c): |
821 | # Modify the location of the softhsm tokens and configuration directory. | |
822 | # Enables token generation by non-root users (runner) | |
823 | c.run('mkdir -p /opt/pdns-auth/softhsm/tokens') | |
824 | c.run('echo "directories.tokendir = /opt/pdns-auth/softhsm/tokens" > /opt/pdns-auth/softhsm/softhsm2.conf') | |
825 | ||
0e77de07 PD |
826 | @task |
827 | def test_auth_backend(c, backend): | |
7d862cb3 | 828 | pdns_auth_env_vars = f'PDNS=/opt/pdns-auth/sbin/pdns_server PDNS2=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig NOTIFY=/opt/pdns-auth/bin/pdns_notify NSEC3DIG=/opt/pdns-auth/bin/nsec3dig SAXFR=/opt/pdns-auth/bin/saxfr ZONE2SQL=/opt/pdns-auth/bin/zone2sql ZONE2LDAP=/opt/pdns-auth/bin/zone2ldap ZONE2JSON=/opt/pdns-auth/bin/zone2json PDNSUTIL=/opt/pdns-auth/bin/pdnsutil PDNSCONTROL=/opt/pdns-auth/bin/pdns_control PDNSSERVER=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig GMYSQLHOST={auth_backend_ip_addr} GMYSQL2HOST={auth_backend_ip_addr} MYSQL_HOST={auth_backend_ip_addr} PGHOST={auth_backend_ip_addr} PGPORT=5432' |
8af54cc6 | 829 | |
0e77de07 | 830 | if backend == 'remote': |
e55d3a4b | 831 | ci_auth_install_remotebackend_test_deps(c) |
0e77de07 | 832 | |
222d17e2 | 833 | if backend == 'authpy': |
7d862cb3 | 834 | c.sudo(f'sh -c \'echo "{auth_backend_ip_addr} kerberos-server" | tee -a /etc/hosts\'') |
222d17e2 | 835 | with c.cd('regression-tests.auth-py'): |
8af54cc6 AR |
836 | c.run(f'{pdns_auth_env_vars} WITHKERBEROS=YES ./runtests') |
837 | return | |
838 | ||
57d9ffa8 | 839 | if backend == 'bind': |
840 | setup_softhsm(c) | |
841 | with c.cd('regression-tests'): | |
842 | for variant in backend_regress_tests[backend]: | |
843 | c.run(f'{pdns_auth_env_vars} SOFTHSM2_CONF=/opt/pdns-auth/softhsm/softhsm2.conf ./start-test-stop 5300 {variant}') | |
844 | return | |
845 | ||
8af54cc6 AR |
846 | if backend == 'godbc_sqlite3': |
847 | setup_godbc_sqlite3(c) | |
848 | with c.cd('regression-tests'): | |
849 | for variant in backend_regress_tests[backend]: | |
850 | c.run(f'{pdns_auth_env_vars} GODBC_SQLITE3_DSN=pdns-sqlite3-1 ./start-test-stop 5300 {variant}') | |
851 | return | |
852 | ||
853 | if backend == 'godbc_mssql': | |
854 | setup_godbc_mssql(c) | |
855 | with c.cd('regression-tests'): | |
856 | for variant in backend_regress_tests[backend]: | |
857 | c.run(f'{pdns_auth_env_vars} GODBC_MSSQL_PASSWORD={godbc_mssql_credentials["password"]} GODBC_MSSQL_USERNAME={godbc_mssql_credentials["username"]} GODBC_MSSQL_DSN=pdns-mssql-docker GODBC_MSSQL2_PASSWORD={godbc_mssql_credentials["password"]} GODBC_MSSQL2_USERNAME={godbc_mssql_credentials["username"]} GODBC_MSSQL2_DSN=pdns-mssql-docker ./start-test-stop 5300 {variant}') | |
222d17e2 PD |
858 | return |
859 | ||
c4a7e1df AR |
860 | if backend == 'ldap': |
861 | setup_ldap_client(c) | |
862 | ||
863 | if backend == 'geoip_mmdb': | |
864 | with c.cd('regression-tests'): | |
865 | for variant in backend_regress_tests[backend]: | |
866 | c.run(f'{pdns_auth_env_vars} geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb ./start-test-stop 5300 {variant}') | |
867 | return | |
868 | ||
0e77de07 | 869 | with c.cd('regression-tests'): |
b33a88da PD |
870 | if backend == 'lua2': |
871 | c.run('touch trustedkeys') # avoid silly error during cleanup | |
872 | for variant in backend_regress_tests[backend]: | |
8af54cc6 | 873 | c.run(f'{pdns_auth_env_vars} ./start-test-stop 5300 {variant}') |
222d17e2 PD |
874 | |
875 | if backend == 'gsqlite3': | |
7d862cb3 AR |
876 | if os.getenv('SKIP_IPV6_TESTS'): |
877 | pdns_auth_env_vars += ' context=noipv6' | |
222d17e2 | 878 | with c.cd('regression-tests.nobackend'): |
8af54cc6 | 879 | c.run(f'{pdns_auth_env_vars} ./runtests') |
222d17e2 PD |
880 | c.run('/opt/pdns-auth/bin/pdnsutil test-algorithms') |
881 | return | |
b33a88da PD |
882 | |
883 | @task | |
884 | def test_ixfrdist(c): | |
885 | with c.cd('regression-tests.ixfrdist'): | |
886 | c.run('IXFRDISTBIN=/opt/pdns-auth/bin/ixfrdist ./runtests') | |
0e77de07 | 887 | |
99bb3530 PD |
888 | @task |
889 | def test_dnsdist(c): | |
890 | c.run('chmod +x /opt/dnsdist/bin/*') | |
891 | c.run('ls -ald /var /var/agentx /var/agentx/master') | |
892 | c.run('ls -al /var/agentx/master') | |
893 | with c.cd('regression-tests.dnsdist'): | |
6e8e1c43 | 894 | c.run('DNSDISTBIN=/opt/dnsdist/bin/dnsdist LD_LIBRARY_PATH=/opt/dnsdist/lib/ ENABLE_SUDO_TESTS=1 ./runtests') |
d3cb00f9 | 895 | |
6b45d67b O |
896 | @task |
897 | def test_regression_recursor(c): | |
898 | c.run('/opt/pdns-recursor/sbin/pdns_recursor --version') | |
7d862cb3 | 899 | c.run('PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control ./build-scripts/test-recursor') |
6b45d67b O |
900 | |
901 | @task | |
375c8fd6 O |
902 | def test_bulk_recursor(c, threads, mthreads, shards): |
903 | # We run an extremely small version of the bulk test, as GH does not seem to be able to handle the UDP load | |
6b45d67b O |
904 | with c.cd('regression-tests'): |
905 | c.run('curl -LO http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip') | |
906 | c.run('unzip top-1m.csv.zip -d .') | |
907 | c.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*') | |
30a57c3d | 908 | c.run(f'DNSBULKTEST=/usr/bin/dnsbulktest RECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control THRESHOLD=95 TRACE=no ./recursor-test 5300 100 {threads} {mthreads} {shards}') |
6b45d67b | 909 | |
dab788a9 PD |
910 | @task |
911 | def install_swagger_tools(c): | |
912 | c.run('npm install -g api-spec-converter') | |
913 | ||
914 | @task | |
915 | def swagger_syntax_check(c): | |
916 | c.run('api-spec-converter docs/http-api/swagger/authoritative-api-swagger.yaml -f swagger_2 -t openapi_3 -s json -c') | |
917 | ||
66c07369 | 918 | @task |
df23d4bf RG |
919 | def install_coverity_tools(c, project): |
920 | token = os.getenv('COVERITY_TOKEN') | |
921 | c.run(f'curl -s https://scan.coverity.com/download/linux64 --data "token={token}&project={project}" | gunzip | sudo tar xvf /dev/stdin --strip-components=1 --no-same-owner -C /usr/local', hide=True) | |
66c07369 RG |
922 | |
923 | @task | |
924 | def coverity_clang_configure(c): | |
7d862cb3 | 925 | c.sudo(f'/usr/local/bin/cov-configure --template --comptype clangcc --compiler clang++-{clang_version}') |
66c07369 RG |
926 | |
927 | @task | |
928 | def coverity_make(c): | |
929 | c.run('/usr/local/bin/cov-build --dir cov-int make -j8 -k') | |
930 | ||
931 | @task | |
932 | def coverity_tarball(c, tarball): | |
933 | c.run(f'tar caf {tarball} cov-int') | |
934 | ||
935 | @task | |
df23d4bf RG |
936 | def coverity_upload(c, email, project, tarball): |
937 | token = os.getenv('COVERITY_TOKEN') | |
66c07369 RG |
938 | c.run(f'curl --form token={token} \ |
939 | --form email="{email}" \ | |
940 | --form file=@{tarball} \ | |
941 | --form version="$(./builder-support/gen-version)" \ | |
942 | --form description="master build" \ | |
df23d4bf | 943 | https://scan.coverity.com/builds?project={project}', hide=True) |
66c07369 | 944 | |
3e5c7a76 | 945 | @task |
4ccb0f78 RG |
946 | def ci_build_and_install_quiche(c, repo): |
947 | with open(f'{repo}/builder-support/helpers/quiche.json') as quiche_json: | |
948 | quiche_data = json.load(quiche_json) | |
949 | quiche_version = quiche_data['version'] | |
950 | quiche_hash = quiche_data['SHA256SUM'] | |
951 | ||
3e5c7a76 RG |
952 | # we have to pass -L because GitHub will do a redirect, sadly |
953 | c.run(f'curl -L -o quiche-{quiche_version}.tar.gz https://github.com/cloudflare/quiche/archive/{quiche_version}.tar.gz') | |
954 | # Line below should echo two spaces between digest and name | |
955 | c.run(f'echo {quiche_hash}" "quiche-{quiche_version}.tar.gz | sha256sum -c -') | |
956 | c.run(f'tar xf quiche-{quiche_version}.tar.gz') | |
957 | with c.cd(f'quiche-{quiche_version}'): | |
2ade4784 | 958 | c.run('cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package quiche') |
3e5c7a76 RG |
959 | # cannot use c.sudo() inside a cd() context, see https://github.com/pyinvoke/invoke/issues/687 |
960 | c.run('sudo install -Dm644 quiche/include/quiche.h /usr/include') | |
2ade4784 RG |
961 | c.run('sudo install -Dm644 target/release/libquiche.so /usr/lib') |
962 | c.run('install -D target/release/libquiche.so /opt/dnsdist/lib/libquiche.so') | |
963 | c.run(f"""sudo install -Dm644 /dev/stdin /usr/lib/pkgconfig/quiche.pc <<PC | |
3e5c7a76 RG |
964 | # quiche |
965 | Name: quiche | |
966 | Description: quiche library | |
967 | URL: https://github.com/cloudflare/quiche | |
2ade4784 | 968 | Version: {quiche_version} |
3e5c7a76 RG |
969 | Libs: -lquiche |
970 | PC""") | |
971 | ||
d3cb00f9 PD |
972 | # this is run always |
973 | def setup(): | |
974 | if '/usr/lib/ccache' not in os.environ['PATH']: | |
975 | os.environ['PATH']='/usr/lib/ccache:'+os.environ['PATH'] | |
976 | ||
977 | setup() |