From 490fe01acfef92237e5159f7b4a5fe76bed61f3a Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Thu, 11 Jan 2024 10:21:50 +0000 Subject: [PATCH 1/8] Relicense threadname to GPL-2+ with permission from the author --- ext/ext/threadname.cc | 7 ++++--- ext/ext/threadname.hh | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/ext/threadname.cc b/ext/ext/threadname.cc index 59490448..7822bcb1 100644 --- a/ext/ext/threadname.cc +++ b/ext/ext/threadname.cc @@ -1,10 +1,11 @@ /* - * This file is part of PowerDNS or dnsdist. + * This file is part of PowerDNS or weakforced. * Copyright -- PowerDNS.COM B.V. and its contributors * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * In addition, for the avoidance of any doubt, permission is granted to * link this program with OpenSSL and to (re)distribute the binaries diff --git a/ext/ext/threadname.hh b/ext/ext/threadname.hh index 685116cf..3d6fd6c3 100644 --- a/ext/ext/threadname.hh +++ b/ext/ext/threadname.hh @@ -1,10 +1,11 @@ /* - * This file is part of PowerDNS or dnsdist. + * This file is part of PowerDNS or weakforced. * Copyright -- PowerDNS.COM B.V. and its contributors * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * In addition, for the avoidance of any doubt, permission is granted to * link this program with OpenSSL and to (re)distribute the binaries From 1b1fe8fbb6506fe7f29ea8376aad8acf92511bdc Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Thu, 11 Jan 2024 10:08:50 +0000 Subject: [PATCH 2/8] Remove ctpl.h from files where it is no longer used --- common/webhook.cc | 1 + common/webhook.hh | 1 - common/wforce-webserver.hh | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/common/webhook.cc b/common/webhook.cc index cd27dcb6..11ea96be 100644 --- a/common/webhook.cc +++ b/common/webhook.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include "webhook.hh" #include "dolog.hh" #include "hmac.hh" diff --git a/common/webhook.hh b/common/webhook.hh index c1e0b6b5..741267c9 100644 --- a/common/webhook.hh +++ b/common/webhook.hh @@ -24,7 +24,6 @@ #include #include #include "json11.hpp" -#include "ext/ctpl.h" #include "dolog.hh" #include "minicurl.hh" #include "prometheus.hh" diff --git a/common/wforce-webserver.hh b/common/wforce-webserver.hh index 3cacdbbc..7b0a62eb 100644 --- a/common/wforce-webserver.hh +++ b/common/wforce-webserver.hh @@ -34,7 +34,6 @@ #include "iputils.hh" #include "sstuff.hh" #include "sholder.hh" -#include "ext/ctpl.h" #include "drogon/drogon.h" #include "prometheus.hh" #include "perf-stats.hh" From cb91de0e21feb017715798bf1b3dc4da67625b41 Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Thu, 11 Jan 2024 18:25:07 +0000 Subject: [PATCH 3/8] Add condition_variable include to webhook.hh --- common/webhook.hh | 1 + 1 file changed, 1 insertion(+) diff --git a/common/webhook.hh b/common/webhook.hh index 741267c9..e5f0d7a5 100644 --- a/common/webhook.hh +++ b/common/webhook.hh @@ -23,6 +23,7 @@ #pragma once #include #include +#include #include "json11.hpp" #include "dolog.hh" #include "minicurl.hh" From d6bfaf77c05585c747a885d13d4040d852b3e285 Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Fri, 12 Jan 2024 15:08:28 +0000 Subject: [PATCH 4/8] Add a local GeoIP file so we don't depend on GH secrets for regression tests --- regression-tests/RegressionGeoIP.mmdb | Bin 0 -> 1804 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 regression-tests/RegressionGeoIP.mmdb diff --git a/regression-tests/RegressionGeoIP.mmdb b/regression-tests/RegressionGeoIP.mmdb new file mode 100644 index 0000000000000000000000000000000000000000..616aba7305328dc6a8e569c1907e82d2283773aa GIT binary patch literal 1804 zcmZ9~NpKWZ9LMpO7{Of>#SKEEh=~fL(YVBIGB76T$t0)*6~xY)?q>Rh>3(A`12ZnT zfh*#^D+G6OmxEB}RhB2OdI0C*$%6-v+B09vpnduDd;fpG_pA3>hz=pd0U9uPvs8*utnXH|euV09uGDwL9ioLTVAjLL}5` zuob?6IyB%;xC`!vdtf`XlHJSF_rd+}fDjMTvSY4uXS>#sCTM;4FgyZ}!ej6_?1Cp? zH#`YX!PD>zJPXgkq!2H#`-|`rybQ0vtMD4U4troPOvApE&sq8nA>L&2EqEK=fp_6O zcpvt|2k;?$1RujE@F{!-lm8(d9QHKV*eb3cGRv+Gr0-hFnO)jFm2bUA2Xk(aU#GX! z^^mQTAP(!l8uMqnzuz#dB5m2)adYNcW6?olN#2xI84OpnEn}sF=D4)&B$RgD3Zx|&AEp)^I`&jan9%`qLvDkyu>H&(Rb_4MyC`g23Mc6DqbP_gS6g|x%bzA@S~ z*3a}Ao|iSFS-CJfZZy2F|M=p|?-u;fYwRlKlTcUP%%~0=9T@vW*Zv=WFUoC26*#MG z?f4O`KsJO5u*!CZB3p_HhKW4TprdtIIG^u$!rk+Cev z$hG2n)y) Date: Fri, 12 Jan 2024 15:08:52 +0000 Subject: [PATCH 5/8] Use local GeoIP file in regression config --- regression-tests/wforce-tw.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regression-tests/wforce-tw.conf b/regression-tests/wforce-tw.conf index 45be1670..e223d12f 100644 --- a/regression-tests/wforce-tw.conf +++ b/regression-tests/wforce-tw.conf @@ -226,8 +226,8 @@ end setCustomGetEndpoint("testCustomGet", testCustomGetFunc) -newGeoIP2DB("City", "/usr/share/GeoIP/GeoLite2-City.mmdb") -newGeoIP2DB("Country", "/usr/share/GeoIP/GeoLite2-Country.mmdb") +newGeoIP2DB("City", "RegressionGeoIP.mmdb") +newGeoIP2DB("Country", "RegressionGeoIP.mmdb") function geoip2(args) local ip_address From 622b46adef0a490173717540a529af4db3cb845f Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Fri, 12 Jan 2024 16:13:21 +0000 Subject: [PATCH 6/8] Remove maxmind downloads from docker regression --- docker/regression/Dockerfile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/docker/regression/Dockerfile b/docker/regression/Dockerfile index 21d60559..7d41229b 100644 --- a/docker/regression/Dockerfile +++ b/docker/regression/Dockerfile @@ -41,17 +41,6 @@ RUN apt-get update && \ clang \ cmake -# Disable Ipv6 for redis -ARG MAXMIND_LICENSE_KEY -RUN wget -O GeoLite2-City.mmdb.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz" || true -RUN wget -O GeoLite2-Country.mmdb.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz" || true -RUN wget -O GeoLite2-ASN.mmdb.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz" || true -RUN gunzip GeoLite2-*.mmdb.tar.gz || true -RUN tar xvf GeoLite2-City.mmdb.tar || true -RUN tar xvf GeoLite2-Country.mmdb.tar || true -RUN tar xvf GeoLite2-ASN.mmdb.tar || true -RUN mv GeoLite2*/GeoLite2-*.mmdb /usr/share/GeoIP || true - RUN pip3 install bottle virtualenv WORKDIR /wforce/ From 5ffb99fb2fd01bf9d49dc39803978f1caf2e6bcf Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Fri, 12 Jan 2024 16:29:43 +0000 Subject: [PATCH 7/8] Run regression clang and gcc concurrently to save time --- .github/workflows/regression.yml | 52 ++++------------------- .github/workflows/regression_reusable.yml | 52 +++++++++++++++++++++++ 2 files changed, 61 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/regression_reusable.yml diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index d4540954..44aeda7d 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -1,5 +1,5 @@ --- -name: 'Run regression tests' +name: 'Call reusable regression workflow' on: push: @@ -8,45 +8,11 @@ on: - cron: '0 22 * * 3' jobs: - regression: - name: regression - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 5 - submodules: recursive - - name: Install dependencies - run: sudo apt-get update && sudo apt-get -qq -y install gcc g++ cmake libboost-all-dev libcurl4-openssl-dev libgetdns-dev libhiredis-dev libmaxminddb-dev libluajit-5.1-dev libprotobuf-dev libreadline-dev libssl-dev libsodium-dev libsystemd-dev libyaml-cpp-dev libjsoncpp-dev uuid-dev libz-dev libtool pkg-config protobuf-compiler pandoc wget autoconf automake - - name: Download prometheus-cpp - run: git clone https://github.com/jupp0r/prometheus-cpp.git && cd prometheus-cpp && git checkout tags/v1.0.1 -b v1.0.1 && echo 'include(CPack)' >> CMakeLists.txt - - name: Build and Install prometheus-cpp - run: cd prometheus-cpp && git submodule init && git submodule update && mkdir _build && cd _build && cmake .. -DBUILD_SHARED_LIBS=off -DENABLE_PULL=off -DENABLE_PUSH=off -DENABLE_COMPRESSION=off -DENABLE_TESTING=off -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_POSITION_INDEPENDENT_CODE=ON && make && sudo make install - - name: Download Drogon - run: git clone https://github.com/drogonframework/drogon.git && cd drogon && git checkout tags/v1.9.1 -b v1.9.1 - - name: Build and Install Drogon - run: cd drogon && git submodule init && git submodule update && mkdir _build && cd _build && cmake .. -DBUILD_ORM=OFF -DCMAKE_BUILD_TYPE=Release && make && sudo make install - - run: sudo sysctl -w vm.max_map_count=262144 - - run: autoreconf -i - - run: ./configure --enable-trackalert - - run: cd docker && make regression - env: - MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }} - - run: make dist - - run: make distcheck - - name: Upload Test Results - if: always() - uses: actions/upload-artifact@v3 - with: - name: Test Results - path: | - docker/tmp/*.xml - event_file: - name: "Event File" - runs-on: ubuntu-latest - steps: - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: Event File - path: ${{ github.event_path }} + regression_clang: + uses: ./.github/workflows/regression_reusable.yml + with: + compiler: clang + regression_gcc: + uses: ./.github/workflows/regression_reusable.yml + with: + compiler: gcc \ No newline at end of file diff --git a/.github/workflows/regression_reusable.yml b/.github/workflows/regression_reusable.yml new file mode 100644 index 00000000..b192344f --- /dev/null +++ b/.github/workflows/regression_reusable.yml @@ -0,0 +1,52 @@ +--- +name: 'Run regression tests' + +on: + workflow_call: + inputs: + compiler: + description: 'Compiler to use' + type: string + required: true + +jobs: + run-regression: + name: regression-${{ inputs.compiler }} + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 5 + submodules: recursive + - name: Install dependencies + run: sudo apt-get update && sudo apt-get -qq -y install gcc g++ cmake libboost-all-dev libcurl4-openssl-dev libgetdns-dev libhiredis-dev libmaxminddb-dev libluajit-5.1-dev libprotobuf-dev libreadline-dev libssl-dev libsodium-dev libsystemd-dev libyaml-cpp-dev libjsoncpp-dev uuid-dev libz-dev libtool pkg-config protobuf-compiler pandoc wget autoconf automake + - name: Download prometheus-cpp + run: git clone https://github.com/jupp0r/prometheus-cpp.git && cd prometheus-cpp && git checkout tags/v1.0.1 -b v1.0.1 && echo 'include(CPack)' >> CMakeLists.txt + - name: Build and Install prometheus-cpp + run: cd prometheus-cpp && git submodule init && git submodule update && mkdir _build && cd _build && cmake .. -DBUILD_SHARED_LIBS=off -DENABLE_PULL=off -DENABLE_PUSH=off -DENABLE_COMPRESSION=off -DENABLE_TESTING=off -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_POSITION_INDEPENDENT_CODE=ON && make && sudo make install + - name: Download Drogon + run: git clone https://github.com/drogonframework/drogon.git && cd drogon && git checkout tags/v1.9.1 -b v1.9.1 + - name: Build and Install Drogon + run: cd drogon && git submodule init && git submodule update && mkdir _build && cd _build && cmake .. -DBUILD_ORM=OFF -DCMAKE_BUILD_TYPE=Release && make && sudo make install + - run: sudo sysctl -w vm.max_map_count=262144 + - run: autoreconf -i + - run: ./configure --enable-trackalert + - run: cd docker && make regression-${{ inputs.compiler }} + - run: make dist + - run: make distcheck + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results + path: | + docker/tmp/*.xml + event_file: + name: "Event File" + runs-on: ubuntu-latest + steps: + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: Event File + path: ${{ github.event_path }} From 69e7633c9f2beb92142289afea36780985588355 Mon Sep 17 00:00:00 2001 From: Neil Cook Date: Fri, 12 Jan 2024 23:26:55 +0000 Subject: [PATCH 8/8] Run Publish Test Results workflow on correct regression workflow --- .github/workflows/pubtests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pubtests.yml b/.github/workflows/pubtests.yml index f747de43..a86621ee 100644 --- a/.github/workflows/pubtests.yml +++ b/.github/workflows/pubtests.yml @@ -3,7 +3,7 @@ name: Publish Test Results on: workflow_run: - workflows: ["Run regression tests"] + workflows: ["Call reusable regression workflow"] types: - completed permissions: {}