]>
git.ipfire.org Git - thirdparty/pdns.git/blob - tasks.py
1 from invoke
import task
2 from invoke
.exceptions
import Failure
, UnexpectedExit
8 auth_backend_ip_addr
= os
.getenv('AUTH_BACKEND_IP_ADDR', '127.0.0.1')
10 clang_version
= os
.getenv('CLANG_VERSION', '13')
11 quiche_version
= '0.18.0'
12 quiche_hash
= 'eb242a14c4d801a90b57b6021dd29f7a62099f3a4d7a7ba889e105f8328e6c1f'
19 'libssl-dev', # This will install libssl 1.1 on Debian 11 and libssl3 on Debian 12
37 auth_build_deps
= [ # FIXME: perhaps we should be stealing these from the debian (Ubuntu) control file
38 'default-libmysqlclient-dev',
40 'libcurl4-openssl-dev',
75 dnsdist_build_deps
= [
87 auth_test_deps
= [ # FIXME: we should be generating some of these from shlibdeps in build
92 'default-jre-headless',
98 '"libboost-serialization1.7[1-9]+"',
103 '"libldap-2.[1-9]+"',
113 '"libyaml-cpp0.[1-9]+"',
146 'texlive-formats-extra',
147 'texlive-latex-extra',
152 c
.sudo('apt-get update')
153 c
.sudo('apt-get -y --allow-downgrades dist-upgrade')
156 def install_clang(c
):
158 install clang and llvm
160 c
.sudo(f
'apt-get -y --no-install-recommends install clang-{clang_version} llvm-{clang_version}')
163 def install_clang_tidy_tools(c
):
164 c
.sudo(f
'apt-get -y --no-install-recommends install clang-tidy-{clang_version} clang-tools-{clang_version} bear python3-yaml')
167 def install_clang_runtime(c
):
168 # this gives us the symbolizer, for symbols in asan/ubsan traces
169 c
.sudo(f
'apt-get -y --no-install-recommends install clang-{clang_version}')
172 def ci_install_rust(c
, repo
):
173 c
.sudo(f
'{repo}/builder-support/helpers/install_rust.sh')
175 def install_libdecaf(c
, product
):
176 c
.run('git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf')
177 with c
.cd('/tmp/libdecaf'):
178 c
.run('git checkout 41f349')
179 c
.run(f
'CC={get_c_compiler()} CXX={get_cxx_compiler()} '
181 '-DCMAKE_INSTALL_PREFIX=/usr/local '
182 '-DCMAKE_INSTALL_LIBDIR=lib '
183 '-DENABLE_STATIC=OFF '
184 '-DENABLE_TESTS=OFF '
185 '-DCMAKE_C_FLAGS="-Wno-sizeof-array-div -Wno-array-parameter" .')
186 c
.run('make -C build')
187 c
.run('sudo make -C build install')
188 c
.sudo(f
'mkdir -p /opt/{product}/libdecaf')
189 c
.sudo(f
'cp /usr/local/lib/libdecaf.so* /opt/{product}/libdecaf/.')
192 def install_doc_deps(c
):
193 c
.sudo('apt-get install -y ' + ' '.join(doc_deps
))
196 def install_doc_deps_pdf(c
):
197 c
.sudo('apt-get install -y ' + ' '.join(doc_deps_pdf
))
200 def install_auth_build_deps(c
):
201 c
.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps
+ git_build_deps
+ auth_build_deps
))
202 if os
.getenv('DECAF_SUPPORT', 'no') == 'yes':
203 install_libdecaf(c
, 'pdns-auth')
205 def is_coverage_enabled():
206 sanitizers
= os
.getenv('SANITIZERS')
208 sanitizers
= sanitizers
.split('+')
209 if 'tsan' in sanitizers
:
211 return os
.getenv('COVERAGE') == 'yes'
214 return '--enable-coverage=clang' if is_coverage_enabled() else ''
217 def install_coverage_deps(c
):
218 if is_coverage_enabled():
219 c
.sudo(f
'apt-get install -y --no-install-recommends llvm-{clang_version}')
222 def generate_coverage_info(c
, binary
, outputDir
):
223 if is_coverage_enabled():
224 version
= os
.getenv('BUILDER_VERSION')
225 c
.run(f
'llvm-profdata-{clang_version} merge -sparse -o {outputDir}/temp.profdata /tmp/code-*.profraw')
226 c
.run(f
'llvm-cov-{clang_version} export --format=lcov --ignore-filename-regex=\'^/usr/\' -instr-profile={outputDir}/temp.profdata -object {binary} > {outputDir}/coverage.lcov')
227 c
.run(f
'{outputDir}/.github/scripts/normalize_paths_in_coverage.py {outputDir} {version} {outputDir}/coverage.lcov {outputDir}/normalized_coverage.lcov')
228 c
.run(f
'mv {outputDir}/normalized_coverage.lcov {outputDir}/coverage.lcov')
230 def setup_authbind(c
):
231 c
.sudo('touch /etc/authbind/byport/53')
232 c
.sudo('chmod 755 /etc/authbind/byport/53')
234 auth_backend_test_deps
= dict(
235 gsqlite3
=['sqlite3'],
236 gmysql
=['default-libmysqlclient-dev'],
237 gpgsql
=['libpq-dev'],
245 godbc_sqlite3
=['libsqliteodbc'],
246 godbc_mssql
=['freetds-bin','tdsodbc'],
251 @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable
=['backend'], optional
=['backend'])
252 def install_auth_test_deps(c
, backend
): # FIXME: rename this, we do way more than apt-get
255 extra
.extend(auth_backend_test_deps
[b
])
256 c
.sudo('DEBIAN_FRONTEND=noninteractive apt-get -y install ' + ' '.join(extra
+auth_test_deps
))
258 c
.run('chmod +x /opt/pdns-auth/bin/* /opt/pdns-auth/sbin/*')
259 # c.run('''if [ ! -e $HOME/bin/jdnssec-verifyzone ]; then
260 # wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz
261 # tar xfz jdnssec-tools-0.14.tar.gz -C $HOME
262 # rm jdnssec-tools-0.14.tar.gz
264 # echo 'export PATH=$HOME/jdnssec-tools-0.14/bin:$PATH' >> $BASH_ENV''') # FIXME: why did this fail with no error?
265 c
.run('touch regression-tests/tests/verify-dnssec-zone/allow-missing regression-tests.nobackend/rectify-axfr/allow-missing') # FIXME: can this go?
266 # FIXME we may want to start a background recursor here to make ALIAS tests more robust
269 if os
.getenv('DECAF_SUPPORT', 'no') == 'yes':
271 c
.sudo('mkdir -p /usr/local/lib')
272 c
.sudo('cp /opt/pdns-auth/libdecaf/libdecaf.so* /usr/local/lib/.')
275 def install_rec_bulk_deps(c
): # FIXME: rename this, we do way more than apt-get
276 c
.sudo('apt-get --no-install-recommends -y install ' + ' '.join(rec_bulk_deps
))
277 c
.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
280 def install_rec_test_deps(c
): # FIXME: rename this, we do way more than apt-get
281 c
.sudo('apt-get --no-install-recommends install -y ' + ' '.join(rec_bulk_deps
) + ' \
282 pdns-server pdns-backend-bind daemontools \
283 jq libfaketime lua-posix lua-socket bc authbind \
284 python3-venv python3-dev default-libmysqlclient-dev libpq-dev \
285 protobuf-compiler snmpd prometheus')
287 c
.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
291 c
.run('sed "s/agentxperms 0700 0755 recursor/agentxperms 0777 0755/g" regression-tests.recursor-dnssec/snmpd.conf | sudo tee /etc/snmp/snmpd.conf')
292 c
.sudo('/etc/init.d/snmpd restart')
294 c
.sudo('chmod 755 /var/agentx')
297 def install_dnsdist_test_deps(c
): # FIXME: rename this, we do way more than apt-get
298 c
.sudo('apt-get install -y \
303 libcurl4-openssl-dev \
316 python3-venv snmpd prometheus')
317 c
.run('sed "s/agentxperms 0700 0755 dnsdist/agentxperms 0777 0755/g" regression-tests.dnsdist/snmpd.conf | sudo tee /etc/snmp/snmpd.conf')
318 c
.sudo('/etc/init.d/snmpd restart')
320 c
.sudo('chmod 755 /var/agentx')
323 def install_rec_build_deps(c
):
324 c
.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps
+ git_build_deps
+ rec_build_deps
))
327 def install_dnsdist_build_deps(c
):
328 c
.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps
+ git_build_deps
+ dnsdist_build_deps
))
332 c
.run('autoreconf -vfi')
335 def ci_docs_rec_generate(c
):
336 c
.run('python3 generate.py')
339 def ci_docs_build(c
):
340 c
.run('make -f Makefile.sphinx -C docs html')
343 def ci_docs_build_pdf(c
):
344 c
.run('make -f Makefile.sphinx -C docs latexpdf')
347 def ci_docs_upload_master(c
, docs_host
, pdf
, username
, product
, directory
=""):
348 rsync_cmd
= " ".join([
357 c
.run(f
"{rsync_cmd} --delete ./docs/_build/{product}-html-docs/ {username}@{docs_host}:{directory}")
358 c
.run(f
"{rsync_cmd} ./docs/_build/{product}-html-docs.tar.bz2 {username}@{docs_host}:{directory}/html-docs.tar.bz2")
359 c
.run(f
"{rsync_cmd} ./docs/_build/latex/{pdf} {username}@{docs_host}:{directory}")
362 def ci_docs_add_ssh(c
, ssh_key
, host_key
):
363 c
.run('mkdir -m 700 -p ~/.ssh')
364 c
.run(f
'echo "{ssh_key}" > ~/.ssh/id_ed25519')
365 c
.run('chmod 600 ~/.ssh/id_ed25519')
366 c
.run(f
'echo "{host_key}" > ~/.ssh/known_hosts')
369 def get_sanitizers():
370 sanitizers
= os
.getenv('SANITIZERS', '')
372 sanitizers
= sanitizers
.split('+')
373 sanitizers
= ['--enable-' + sanitizer
for sanitizer
in sanitizers
]
374 sanitizers
= ' '.join(sanitizers
)
377 def get_unit_tests(auth
=False):
378 if os
.getenv('UNIT_TESTS') != 'yes':
380 return '--enable-unit-tests --enable-backend-unit-tests' if auth
else '--enable-unit-tests'
382 def get_build_concurrency(default
=8):
383 return os
.getenv('CONCURRENCY', default
)
385 def get_fuzzing_targets():
386 return '--enable-fuzz-targets' if os
.getenv('FUZZING_TARGETS') == 'yes' else ''
388 def is_compiler_clang():
389 compiler
= os
.getenv('COMPILER', 'clang')
390 return compiler
== 'clang'
392 def get_c_compiler():
393 return f
'clang-{clang_version}' if is_compiler_clang() else 'gcc'
395 def get_cxx_compiler():
396 return f
'clang++-{clang_version}' if is_compiler_clang() else 'g++'
398 def get_optimizations():
399 optimizations
= os
.getenv('OPTIMIZATIONS', 'yes')
400 return '-O1' if optimizations
== 'yes' else '-O0'
408 "-Werror=format-security",
409 "-Werror=string-plus-int" if is_compiler_clang() else '',
416 "-Wp,-D_GLIBCXX_ASSERTIONS",
420 def get_base_configure_cmd(additional_c_flags
='', additional_cxx_flags
='', enable_systemd
=True, enable_sodium
=True):
421 cflags
= " ".join([get_cflags(), additional_c_flags
])
422 cxxflags
= " ".join([get_cxxflags(), additional_cxx_flags
])
424 f
'CFLAGS="{cflags}"',
425 f
'CXXFLAGS="{cxxflags}"',
427 f
"CC='{get_c_compiler()}'",
428 f
"CXX='{get_cxx_compiler()}'",
429 "--enable-option-checking=fatal",
430 "--enable-systemd" if enable_systemd
else '',
431 "--with-libsodium" if enable_sodium
else '',
432 "--enable-fortify-source=auto",
433 "--enable-auto-var-init=pattern",
440 def ci_auth_configure(c
):
441 unittests
= get_unit_tests(True)
442 fuzz_targets
= get_fuzzing_targets()
457 configure_cmd
= " ".join([
458 get_base_configure_cmd(),
459 "LDFLAGS='-L/usr/local/lib -Wl,-rpath,/usr/local/lib'",
460 f
"--with-modules='{modules}'",
462 "--enable-dns-over-tls",
463 "--enable-experimental-pkcs11",
464 "--enable-experimental-gss-tsig",
465 "--enable-remotebackend-zeromq",
467 "--with-libdecaf" if os
.getenv('DECAF_SUPPORT', 'no') == 'yes' else '',
468 "--prefix=/opt/pdns-auth",
473 res
= c
.run(configure_cmd
, warn
=True)
475 c
.run('cat config.log')
476 raise UnexpectedExit(res
)
480 def ci_rec_configure(c
):
481 unittests
= get_unit_tests()
483 configure_cmd
= " ".join([
484 get_base_configure_cmd(),
486 "--prefix=/opt/pdns-recursor",
490 "--enable-dns-over-tls",
493 res
= c
.run(configure_cmd
, warn
=True)
495 c
.run('cat config.log')
496 raise UnexpectedExit(res
)
500 def ci_dnsdist_configure(c
, features
):
501 additional_flags
= ''
502 if features
== 'full':
503 features_set
= '--enable-dnstap \
505 --enable-dns-over-tls \
506 --enable-dns-over-https \
507 --enable-dns-over-quic \
508 --enable-dns-over-http3 \
510 --prefix=/opt/dnsdist \
520 features_set
= '--disable-dnstap \
529 --without-libsodium \
534 additional_flags
= '-DDISABLE_COMPLETION \
535 -DDISABLE_DELAY_PIPE \
536 -DDISABLE_DYNBLOCKS \
537 -DDISABLE_PROMETHEUS \
539 -DDISABLE_BUILTIN_HTML \
542 -DDISABLE_DEPRECATED_DYNBLOCK \
543 -DDISABLE_LUA_WEB_HANDLERS \
544 -DDISABLE_NON_FFI_DQ_BINDINGS \
545 -DDISABLE_POLICIES_BINDINGS \
546 -DDISABLE_PACKETCACHE_BINDINGS \
547 -DDISABLE_DOWNSTREAM_BINDINGS \
548 -DDISABLE_COMBO_ADDR_BINDINGS \
549 -DDISABLE_CLIENT_STATE_BINDINGS \
550 -DDISABLE_QPS_LIMITER_BINDINGS \
551 -DDISABLE_SUFFIX_MATCH_BINDINGS \
552 -DDISABLE_NETMASK_BINDINGS \
553 -DDISABLE_DNSNAME_BINDINGS \
554 -DDISABLE_DNSHEADER_BINDINGS \
556 -DDISABLE_WEB_CACHE_MANAGEMENT \
557 -DDISABLE_WEB_CONFIG \
558 -DDISABLE_RULES_ALTERING_QUERIES \
559 -DDISABLE_ECS_ACTIONS \
560 -DDISABLE_TOP_N_BINDINGS \
561 -DDISABLE_OCSP_STAPLING \
562 -DDISABLE_HASHED_CREDENTIALS \
563 -DDISABLE_FALSE_SHARING_PADDING \
565 unittests
= get_unit_tests()
566 fuzztargets
= get_fuzzing_targets()
567 tools
= f
'''AR=llvm-ar-{clang_version} RANLIB=llvm-ranlib-{clang_version}''' if is_compiler_clang() else ''
568 configure_cmd
= " ".join([
570 get_base_configure_cmd(additional_c_flags
='', additional_cxx_flags
=additional_flags
, enable_systemd
=False, enable_sodium
=False),
574 ' --enable-lto=thin',
575 '--prefix=/opt/dnsdist'
578 res
= c
.run(configure_cmd
, warn
=True)
580 c
.run('cat config.log')
581 raise UnexpectedExit(res
)
585 c
.run(f
'make -j{get_build_concurrency()} -k V=1')
588 def ci_auth_make_bear(c
):
589 c
.run(f
'bear --append -- make -j{get_build_concurrency()} -k V=1')
593 c
.run(f
'make -j{get_build_concurrency()} -k V=1')
596 def ci_rec_make_bear(c
):
597 # Assumed to be running under ./pdns/recursordist/
598 c
.run(f
'bear --append -- make -j{get_build_concurrency()} -k V=1')
601 def ci_dnsdist_make(c
):
602 c
.run(f
'make -j{get_build_concurrency(4)} -k V=1')
605 def ci_dnsdist_make_bear(c
):
606 # Assumed to be running under ./pdns/dnsdistdist/
607 c
.run(f
'bear --append -- make -j{get_build_concurrency(4)} -k V=1')
610 def ci_auth_install_remotebackend_test_deps(c
):
611 with c
.cd('modules/remotebackend'):
612 # c.run('bundle config set path vendor/bundle')
613 c
.run('sudo ruby -S bundle install')
614 c
.sudo('apt-get install -y socat')
617 def ci_auth_run_unit_tests(c
):
618 res
= c
.run('make check', warn
=True)
620 c
.run('cat pdns/test-suite.log', warn
=True)
621 c
.run('cat modules/remotebackend/test-suite.log', warn
=True)
622 raise UnexpectedExit(res
)
625 def ci_rec_run_unit_tests(c
):
626 res
= c
.run('make check', warn
=True)
628 c
.run('cat test-suite.log')
629 raise UnexpectedExit(res
)
632 def ci_dnsdist_run_unit_tests(c
):
633 res
= c
.run('make check', warn
=True)
635 c
.run('cat test-suite.log')
636 raise UnexpectedExit(res
)
639 def ci_make_distdir(c
):
640 res
= c
.run('make distdir')
643 def ci_make_install(c
):
644 res
= c
.run('make install') # FIXME: this builds auth docs - again
647 def add_auth_repo(c
, dist_name
, dist_release_name
, pdns_repo_version
):
648 c
.sudo('apt-get install -y curl gnupg2')
649 if pdns_repo_version
== 'master':
650 c
.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/CBC8B383-pub.asc')
652 c
.sudo('curl -s -o /etc/apt/trusted.gpg.d/pdns-repo.asc https://repo.powerdns.com/FD380FBB-pub.asc')
653 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")
654 c
.run("echo 'Package: pdns-*' | sudo tee /etc/apt/preferences.d/pdns")
655 c
.run("echo 'Pin: origin repo.powerdns.com' | sudo tee -a /etc/apt/preferences.d/pdns")
656 c
.run("echo 'Pin-Priority: 600' | sudo tee -a /etc/apt/preferences.d/pdns")
657 c
.sudo('apt-get update')
660 def test_api(c
, product
, backend
=''):
661 if product
== 'recursor':
662 with c
.cd('regression-tests.api'):
663 c
.run(f
'PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor ./runtests recursor {backend}')
664 elif product
== 'auth':
665 with c
.cd('regression-tests.api'):
666 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}')
668 raise Failure('unknown product')
670 backend_regress_tests
= dict(
674 'bind-dnssec-nsec3-both',
675 'bind-dnssec-nsec3-optout-both',
676 'bind-dnssec-nsec3-narrow',
683 lua2
= ['lua2', 'lua2-dnssec'],
684 tinydns
= ['tinydns'],
686 'remotebackend-pipe',
687 'remotebackend-unix',
688 'remotebackend-http',
689 'remotebackend-zeromq',
690 'remotebackend-pipe-dnssec',
691 'remotebackend-unix-dnssec',
692 'remotebackend-http-dnssec',
693 'remotebackend-zeromq-dnssec'
696 'lmdb-nodnssec-both',
699 'lmdb-nsec3-optout-both',
704 'gmysql-nodnssec-both',
706 'gmysql-nsec3-optout-both',
707 'gmysql-nsec3-narrow',
712 'gpgsql-nodnssec-both',
714 'gpgsql-nsec3-optout-both',
715 'gpgsql-nsec3-narrow',
720 'gsqlite3-nodnssec-both',
721 'gsqlite3-nsec3-both',
722 'gsqlite3-nsec3-optout-both',
723 'gsqlite3-nsec3-narrow'
725 godbc_sqlite3
= ['godbc_sqlite3-nodnssec'],
728 'godbc_mssql-nodnssec',
730 'godbc_mssql-nsec3-optout',
731 'godbc_mssql-nsec3-narrow'
738 geoip_mmdb
= ['geoip'],
741 godbc_mssql_credentials
= {"username": "sa", "password": "SAsa12%%-not-a-secret-password"}
747 Server={auth_backend_ip_addr}
752 [pdns-mssql-docker-nodb]
755 Server={auth_backend_ip_addr}
761 Database = pdns.sqlite3
765 Database = pdns.sqlite32
768 def setup_godbc_mssql(c
):
769 with
open(os
.path
.expanduser("~/.odbc.ini"), "a") as f
:
770 f
.write(godbc_config
)
771 c
.sudo('sh -c \'echo "Threading=1" | cat /usr/share/tdsodbc/odbcinst.ini - | tee -a /etc/odbcinst.ini\'')
772 c
.sudo('sed -i "s/libtdsodbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libtdsodbc.so/g" /etc/odbcinst.ini')
773 c
.run(f
'echo "create database pdns" | isql -v pdns-mssql-docker-nodb {godbc_mssql_credentials["username"]} {godbc_mssql_credentials["password"]}')
774 # FIXME: Skip 8bit-txt-unescaped test
775 c
.run('touch ${PWD}/regression-tests/tests/8bit-txt-unescaped/skip')
777 def setup_godbc_sqlite3(c
):
778 with
open(os
.path
.expanduser("~/.odbc.ini"), "a") as f
:
779 f
.write(godbc_config
)
780 c
.sudo('sed -i "s/libsqlite3odbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libsqlite3odbc.so/g" /etc/odbcinst.ini')
782 def setup_ldap_client(c
):
783 c
.sudo('DEBIAN_FRONTEND=noninteractive apt-get install -y ldap-utils')
784 c
.sudo(f
'sh -c \'echo "{auth_backend_ip_addr} ldapserver" | tee -a /etc/hosts\'')
786 def setup_softhsm(c
):
787 # Modify the location of the softhsm tokens and configuration directory.
788 # Enables token generation by non-root users (runner)
789 c
.run('mkdir -p /opt/pdns-auth/softhsm/tokens')
790 c
.run('echo "directories.tokendir = /opt/pdns-auth/softhsm/tokens" > /opt/pdns-auth/softhsm/softhsm2.conf')
793 def test_auth_backend(c
, backend
):
794 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'
796 if backend
== 'remote':
797 ci_auth_install_remotebackend_test_deps(c
)
799 if backend
== 'authpy':
800 c
.sudo(f
'sh -c \'echo "{auth_backend_ip_addr} kerberos-server" | tee -a /etc/hosts\'')
801 with c
.cd('regression-tests.auth-py'):
802 c
.run(f
'{pdns_auth_env_vars} WITHKERBEROS=YES ./runtests')
805 if backend
== 'bind':
807 with c
.cd('regression-tests'):
808 for variant
in backend_regress_tests
[backend
]:
809 c
.run(f
'{pdns_auth_env_vars} SOFTHSM2_CONF=/opt/pdns-auth/softhsm/softhsm2.conf ./start-test-stop 5300 {variant}')
812 if backend
== 'godbc_sqlite3':
813 setup_godbc_sqlite3(c
)
814 with c
.cd('regression-tests'):
815 for variant
in backend_regress_tests
[backend
]:
816 c
.run(f
'{pdns_auth_env_vars} GODBC_SQLITE3_DSN=pdns-sqlite3-1 ./start-test-stop 5300 {variant}')
819 if backend
== 'godbc_mssql':
821 with c
.cd('regression-tests'):
822 for variant
in backend_regress_tests
[backend
]:
823 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}')
826 if backend
== 'ldap':
829 if backend
== 'geoip_mmdb':
830 with c
.cd('regression-tests'):
831 for variant
in backend_regress_tests
[backend
]:
832 c
.run(f
'{pdns_auth_env_vars} geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb ./start-test-stop 5300 {variant}')
835 with c
.cd('regression-tests'):
836 if backend
== 'lua2':
837 c
.run('touch trustedkeys') # avoid silly error during cleanup
838 for variant
in backend_regress_tests
[backend
]:
839 c
.run(f
'{pdns_auth_env_vars} ./start-test-stop 5300 {variant}')
841 if backend
== 'gsqlite3':
842 if os
.getenv('SKIP_IPV6_TESTS'):
843 pdns_auth_env_vars
+= ' context=noipv6'
844 with c
.cd('regression-tests.nobackend'):
845 c
.run(f
'{pdns_auth_env_vars} ./runtests')
846 c
.run('/opt/pdns-auth/bin/pdnsutil test-algorithms')
850 def test_ixfrdist(c
):
851 with c
.cd('regression-tests.ixfrdist'):
852 c
.run('IXFRDISTBIN=/opt/pdns-auth/bin/ixfrdist ./runtests')
856 c
.run('chmod +x /opt/dnsdist/bin/*')
857 c
.run('ls -ald /var /var/agentx /var/agentx/master')
858 c
.run('ls -al /var/agentx/master')
859 with c
.cd('regression-tests.dnsdist'):
860 c
.run('DNSDISTBIN=/opt/dnsdist/bin/dnsdist LD_LIBRARY_PATH=/opt/dnsdist/lib/ ./runtests')
863 def test_regression_recursor(c
):
864 c
.run('/opt/pdns-recursor/sbin/pdns_recursor --version')
865 c
.run('PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor RECCONTROL=/opt/pdns-recursor/bin/rec_control ./build-scripts/test-recursor')
868 def test_bulk_recursor(c
, threads
, mthreads
, shards
):
869 # We run an extremely small version of the bulk test, as GH does not seem to be able to handle the UDP load
870 with c
.cd('regression-tests'):
871 c
.run('curl -LO http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip')
872 c
.run('unzip top-1m.csv.zip -d .')
873 c
.run('chmod +x /opt/pdns-recursor/bin/* /opt/pdns-recursor/sbin/*')
874 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}')
877 def install_swagger_tools(c
):
878 c
.run('npm install -g api-spec-converter')
881 def swagger_syntax_check(c
):
882 c
.run('api-spec-converter docs/http-api/swagger/authoritative-api-swagger.yaml -f swagger_2 -t openapi_3 -s json -c')
885 def install_coverity_tools(c
, project
):
886 token
= os
.getenv('COVERITY_TOKEN')
887 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)
890 def coverity_clang_configure(c
):
891 c
.sudo(f
'/usr/local/bin/cov-configure --template --comptype clangcc --compiler clang++-{clang_version}')
894 def coverity_make(c
):
895 c
.run('/usr/local/bin/cov-build --dir cov-int make -j8 -k')
898 def coverity_tarball(c
, tarball
):
899 c
.run(f
'tar caf {tarball} cov-int')
902 def coverity_upload(c
, email
, project
, tarball
):
903 token
= os
.getenv('COVERITY_TOKEN')
904 c
.run(f
'curl --form token={token} \
905 --form email="{email}" \
906 --form file=@{tarball} \
907 --form version="$(./builder-support/gen-version)" \
908 --form description="master build" \
909 https://scan.coverity.com/builds?project={project}', hide
=True)
912 def ci_build_and_install_quiche(c
):
913 # we have to pass -L because GitHub will do a redirect, sadly
914 c
.run(f
'curl -L -o quiche-{quiche_version}.tar.gz https://github.com/cloudflare/quiche/archive/{quiche_version}.tar.gz')
915 # Line below should echo two spaces between digest and name
916 c
.run(f
'echo {quiche_hash}" "quiche-{quiche_version}.tar.gz | sha256sum -c -')
917 c
.run(f
'tar xf quiche-{quiche_version}.tar.gz')
918 with c
.cd(f
'quiche-{quiche_version}'):
919 c
.run('cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package quiche')
920 # cannot use c.sudo() inside a cd() context, see https://github.com/pyinvoke/invoke/issues/687
921 c
.run('sudo install -Dm644 quiche/include/quiche.h /usr/include')
922 c
.run('sudo install -Dm644 target/release/libquiche.so /usr/lib')
923 c
.run('install -D target/release/libquiche.so /opt/dnsdist/lib/libquiche.so')
924 c
.run(f
"""sudo install -Dm644 /dev/stdin /usr/lib/pkgconfig/quiche.pc <<PC
927 Description: quiche library
928 URL: https://github.com/cloudflare/quiche
929 Version: {quiche_version}
935 if '/usr/lib/ccache' not in os
.environ
['PATH']:
936 os
.environ
['PATH']='/usr/lib/ccache:'+os
.environ
['PATH']