diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 331089dabc..c0ae6aea00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,434 +1,12 @@ variables: - # Not normally needed, but may be if some script uses `apt-get install`. - DEBIAN_FRONTEND: noninteractive - # Locale settings do not affect the build, but might affect tests. - LC_ALL: C - - CI_REGISTRY_IMAGE: registry.gitlab.isc.org/isc-projects/images/bind9 - CCACHE_DIR: "/ccache" - SOFTHSM2_CONF: "/var/tmp/softhsm2/softhsm2.conf" - - GIT_DEPTH: 1 - BUILD_PARALLEL_JOBS: 6 - TEST_PARALLEL_JOBS: 6 - - CONFIGURE: ./configure - CLANG: clang-11 - SCAN_BUILD: scan-build-11 - ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-11/bin/llvm-symbolizer - CLANG_FORMAT: clang-format-11 - - CFLAGS_COMMON: -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra - - # Pass run-time flags to AddressSanitizer to get core dumps on error. - ASAN_OPTIONS_COMMON: abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1 - TSAN_OPTIONS_COMMON: "disable_coredump=0 second_deadlock_stack=1 history_size=7 log_exe_name=true log_path=tsan external_symbolizer_path=/usr/lib/llvm-11/bin/llvm-symbolizer" - - TARBALL_EXTENSION: xz - - AM_COLOR_TESTS: always - - WITHOUT_READLINE: "--without-readline" - WITH_READLINE: "--with-readline" - WITH_READLINE_EDITLINE: "--with-readline=editline" - WITH_READLINE_LIBEDIT: "--with-readline=libedit" - WITH_READLINE_READLINE: "--with-readline=readline" - - BIND_INSTALL_PATH: "${CI_PROJECT_DIR}/.local" - - # In multithreaded unit tests, abort on the first failure - CMOCKA_TEST_ABORT: 1 - - # Default platforms to run "stress" tests on - BIND_STRESS_TEST_OS: linux - BIND_STRESS_TEST_ARCH: amd64 - - SHOTGUN_SCENARIO: - value: "udp" - description: "protocol combination to be tested, must be one of https://gitlab.nic.cz/knot/resolver-benchmarking/-/tree/master/roles/shotgun/files" - SHOTGUN_DURATION: - value: 60 - description: "test length in seconds" - SHOTGUN_TRAFFIC_MULTIPLIER: - value: 10 - description: "multiply client traffic, base value 1 = roughly 8 k QPS" - SHOTGUN_PERF_PROFILER: - value: "true" - description: "true/false = enable/disable profiling, disable for runs longer than 1 minute" - EXPERIMENT_CUSTOM_VERSION: + SHOTGUN_TEST_VERSION: value: "$CI_COMMIT_SHA" - description: "DO NOT USE; this field does nothing for now" + description: "version to be tested" stages: - performance - performance2 -### Runner Tag Templates - -.libvirt-amd64: &libvirt_amd64 - tags: - - libvirt - - amd64 - -.linux-amd64: &linux_amd64 - tags: - - linux - - amd64 - -.linux-stress-amd64: &linux_stress_amd64 - tags: - - amd64 - - aws - - linux-stress - - stress - -.linux-stress-arm64: &linux_stress_arm64 - tags: - - aarch64 - - aws - - linux-stress - - stress - -.freebsd-stress-amd64: &freebsd_stress_amd64 - tags: - - amd64 - - aws - - bsd-stress - - stress - -.windows-amd64: &windows_amd64 - tags: - - windows - - amd64 - -### Docker Image Templates - -# Alpine Linux - -.alpine-3.13-amd64: &alpine_3_13_amd64_image - image: "$CI_REGISTRY_IMAGE:alpine-3.13-amd64" - <<: *linux_amd64 - -# CentOS - -.centos-centos7-amd64: ¢os_centos7_amd64_image - image: "$CI_REGISTRY_IMAGE:centos-centos7-amd64" - <<: *linux_amd64 - -.centos-centos8-amd64: ¢os_centos8_amd64_image - image: "$CI_REGISTRY_IMAGE:centos-centos8-amd64" - <<: *linux_amd64 - -# Debian - -.debian-stretch-amd64: &debian_stretch_amd64_image - image: "$CI_REGISTRY_IMAGE:debian-stretch-amd64" - <<: *linux_amd64 - -.debian-buster-amd64: &debian_buster_amd64_image - image: "$CI_REGISTRY_IMAGE:debian-buster-amd64" - <<: *linux_amd64 - -.debian-sid-amd64: &debian_sid_amd64_image - image: "$CI_REGISTRY_IMAGE:debian-sid-amd64" - <<: *linux_amd64 - -# openSUSE Tumbleweed - -.tumbleweed-latest-amd64: &tumbleweed_latest_amd64_image - image: "$CI_REGISTRY_IMAGE:tumbleweed-latest-amd64" - <<: *linux_amd64 - -# Fedora - -.fedora-33-amd64: &fedora_33_amd64_image - image: "$CI_REGISTRY_IMAGE:fedora-33-amd64" - <<: *linux_amd64 - -.fedora-33-arm64: &fedora_33_arm64_image - image: "$CI_REGISTRY_IMAGE:fedora-33-arm64" - <<: *linux_stress_arm64 - -# Ubuntu - -.ubuntu-focal-amd64: &ubuntu_focal_amd64_image - image: "$CI_REGISTRY_IMAGE:ubuntu-focal-amd64" - <<: *linux_amd64 - -# Windows - -.windows-server-2016-amd64: &windows_server_2016_amd64_image - image: "$CI_REGISTRY_IMAGE:windows-server-2016-amd64" - <<: *windows_amd64 - -# Base image -# This is a meta image that is used as a base for non-specific jobs - -.base: &base_image - <<: *debian_buster_amd64_image - -### QCOW2 Image Templates - -.freebsd-11-amd64: &freebsd_11_amd64_image - image: "freebsd-11.4-x86_64" - <<: *libvirt_amd64 - -.freebsd-12-amd64: &freebsd_12_amd64_image - image: "freebsd-12.2-x86_64" - <<: *libvirt_amd64 - -.openbsd-amd64: &openbsd_amd64_image - image: "openbsd-6.8-x86_64" - <<: *libvirt_amd64 - -### Job Templates - -.default-triggering-rules: &default_triggering_rules - only: - - merge_requests - - tags - - web - - schedules - -.release-branch-triggering-rules: &release_branch_triggering_rules - only: - - merge_requests - - tags - - web - - schedules - - main@isc-projects/bind9 - - /^v9_[1-9][0-9]$/@isc-projects/bind9 - -.precheck: &precheck_job - <<: *default_triggering_rules - <<: *base_image - stage: precheck - -.autoconf: &autoconf_job - <<: *release_branch_triggering_rules - <<: *base_image - stage: autoconf - script: - - autoreconf -fi - artifacts: - untracked: true - expire_in: "1 day" - -.configure: &configure | - ${CONFIGURE} \ - --disable-maintainer-mode \ - --enable-developer \ - --enable-option-checking=fatal \ - --with-cmocka \ - --with-libxml2 \ - --with-json-c \ - --prefix="${BIND_INSTALL_PATH}" \ - $EXTRA_CONFIGURE \ - || (test -s config.log && cat config.log; exit 1) - -.check_readline_setup: &check_readline_setup | - if [[ -n "${WITHOUT_READLINE}" ]]; then \ - ! grep "^#define HAVE_READLINE" config.h; \ - elif [[ -n "${WITH_READLINE}" ]]; then \ - grep -e "^#define HAVE_READLINE_READLINE" \ - -e "^#define HAVE_READLINE_LIBEDIT" \ - -e "^#define HAVE_READLINE_EDITLINE" config.h; \ - elif [[ -n "${WITH_READLINE_EDITLINE}" ]]; then \ - grep "^#define HAVE_READLINE_EDITLINE" config.h; \ - elif [[ -n "${WITH_READLINE_LIBEDIT}" ]]; then \ - grep "^#define HAVE_READLINE_LIBEDIT" config.h; \ - elif [[ -n "${WITH_READLINE_READLINE}" ]]; then \ - grep "^#define HAVE_READLINE_READLINE" config.h; \ - fi - -.build: &build_job - <<: *default_triggering_rules - stage: build - before_script: - - test -w "${CCACHE_DIR}" && export PATH="/usr/lib/ccache:${PATH}" - - test -n "${OUT_OF_TREE_WORKSPACE}" && mkdir "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" - script: - - *configure - - *check_readline_setup - - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1 - - test -z "${RUN_MAKE_INSTALL}" || make install - - test -z "${RUN_MAKE_INSTALL}" || sh util/check-make-install - - if [[ "${CFLAGS}" == *"-fsanitize=address"* ]]; then ( ! grep -F AddressSanitizer config.log ); fi - - if test -z "${OUT_OF_TREE_WORKSPACE}" && test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi - after_script: - - test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}" - needs: - - job: autoreconf - artifacts: true - artifacts: - untracked: true - expire_in: "1 day" - -.windows_build: &windows_build_job - stage: build - script: - - 'Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build"' - - '& cmd.exe /C "vcvarsall.bat x64 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }' - - 'Pop-Location' - - 'Set-Location win32utils' - - '& "C:/Strawberry/perl/bin/perl.exe" Configure - "with-tools-version=15.0" - "with-platform-toolset=v141" - "with-platform-version=10.0.17763.0" - "with-vcredist=C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Redist/MSVC/14.16.27012/vcredist_x64.exe" - "with-openssl=C:/OpenSSL" - "with-libxml2=C:/libxml2" - "with-libuv=C:/libuv" - "with-nghttp2=C:/nghttp2" - "without-python" - "with-system-tests" - x64' - - 'Set-Item -path "Env:CL" -value "/MP$([Math]::Truncate($BUILD_PARALLEL_JOBS/2))"' - - '& msbuild.exe /maxCpuCount:2 /t:Build /p:Configuration=$VSCONF bind9.sln' - needs: [] - artifacts: - untracked: true - expire_in: "1 day" - when: always - -.setup_interfaces: &setup_interfaces | - if [ "$(id -u)" -eq "0" ]; then - sh -x bin/tests/system/ifconfig.sh up; - else - sudo sh -x bin/tests/system/ifconfig.sh up; - fi - -.setup_softhsm: &setup_softhsm | - export SLOT=$(sh -x bin/tests/prepare-softhsm2.sh) - test -n "${SLOT}" && test "${SLOT}" -gt 0 - -.system_test_common: &system_test_common - <<: *default_triggering_rules - stage: system - before_script: - - *setup_softhsm - # Move the artifacts from the out-of-tree build job to their original location (the out-of-tree workspace). - - test -n "${OUT_OF_TREE_WORKSPACE}" && mv "$(basename "${OUT_OF_TREE_WORKSPACE}")" "${OUT_OF_TREE_WORKSPACE}" - # Continue work in the out-of-tree workspace. - - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" - - *setup_interfaces - script: - - cd bin/tests/system - - make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 - - if git rev-parse > /dev/null 2>&1; then ( ! grep "^I:.*:file.*not removed$" *.log ); fi - after_script: - - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" - - test -d bind-* && cd bind-* - - cat bin/tests/system/test-suite.log - - test -n "${OUT_OF_TREE_WORKSPACE}" && mv "${OUT_OF_TREE_WORKSPACE}" "${CI_PROJECT_DIR}" - -.system_test: &system_test_job - <<: *system_test_common - artifacts: - untracked: true - expire_in: "1 day" - when: on_failure - -.system_test_gcov: &system_test_gcov_job - <<: *system_test_common - artifacts: - untracked: true - expire_in: "1 day" - when: always - -.system_test_tsan: &system_test_tsan_job - <<: *system_test_common - after_script: - - cat bin/tests/system/test-suite.log - - find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \; - artifacts: - expire_in: "1 day" - untracked: true - when: on_failure - -.windows_system_test: &windows_system_test_job - stage: system - script: - - 'Push-Location bin/tests/system' - - '$ifIndex = Get-NetIPInterface -AddressFamily IPv4 -InterfaceMetric 75 | Select-Object -ExpandProperty ifIndex' - - '& C:/tools/cygwin/bin/sed.exe -i "s/^exit.*/netsh interface ipv4 set dnsservers $ifIndex dhcp/; s/\(name\|interface\)=Loopback/$ifIndex/;" ifconfig.bat' - - '& C:/tools/cygwin/bin/sed.exe -i "s/kill -f/kill -W/;" conf.sh stop.pl' - - '& cmd.exe /C ifconfig.bat up; ""' - - 'Start-Sleep 2' - - '$Env:Path = "C:/tools/cygwin/bin;$Env:Path"' - - '& sh.exe runall.sh $TEST_PARALLEL_JOBS' - - 'If (Test-Path C:/CrashDumps/*) { dir C:/CrashDumps; Throw }' - artifacts: - untracked: true - expire_in: "1 day" - when: on_failure - only: - - schedules - - tags - - web - -.unit_test_common: &unit_test_common - <<: *default_triggering_rules - stage: unit - before_script: - - if [ -n "$TCP_CONNECTIONTIMEOUT" ]; then sudo sysctl 'net.inet.tcp.keepinittime=1'; fi - - *setup_softhsm - script: - - make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1 - -.unit_test: &unit_test_job - <<: *unit_test_common - artifacts: - untracked: true - expire_in: "1 day" - when: on_failure - -.unit_test_gcov: &unit_test_gcov_job - <<: *unit_test_common - artifacts: - untracked: true - expire_in: "1 day" - when: always - -.unit_test_tsan: &unit_test_tsan_job - <<: *unit_test_common - after_script: - - find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \; - artifacts: - expire_in: "1 day" - paths: - - lib/*/tests/tsan.* - - tsan/ - when: on_failure - -.cppcheck_args: &run_cppcheck | - cppcheck --enable=warning,performance,portability,information,missingInclude --include=config.h --std=c11 --language=c --project=compile_commands.json --error-exitcode=2 -j ${TEST_PARALLEL_JOBS:-1} --xml --output-file=cppcheck.results --relative-paths="$CI_PROJECT_DIR" --inline-suppr --suppressions-list=util/suppressions.txt - -.cppcheck_report: &cppcheck_report_html | - cppcheck-htmlreport --title="BIND 9 ($CI_COMMIT_SHORT_SHA) Cppcheck Report" --file=cppcheck.results --report-dir=cppcheck_html/ - -.cppcheck: &cppcheck_job - <<: *default_triggering_rules - stage: postcheck - script: - - *configure - - (make -nwk all || true) | compiledb - - export GCC_VERSION=$(gcc --version | sed -n 's/.* \([0-9]\+\)\.[0-9]\+\.[0-9]\+.*/\1/p') - - sed -i "/gcc\",/a\"-DCPPCHECK\", \"-D__STDC__\", \"-D__GNUC__=${GCC_VERSION}\"," compile_commands.json - - *run_cppcheck - after_script: - - *cppcheck_report_html - artifacts: - paths: - - compile_commands.json - - cppcheck.results - - cppcheck_html/ - expire_in: "1 day" - when: on_failure - needs: - - job: autoreconf - artifacts: true - ### Job Definitions # Jobs in the precheck stage