From fdca19e66d9f249b4fc5afbf6d4acd396d570fa9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 15 Apr 2021 13:59:10 +0000 Subject: [PATCH 1/4] Support and test Debian Bullsye (11) Signed-off-by: Daniel --- .github/workflows/test.yml | 2 +- advanced/Scripts/piholeDebug.sh | 4 ++-- automated install/basic-install.sh | 4 ++-- supportedos.txt | 4 ++-- test/_debian_11.Dockerfile | 17 +++++++++++++++++ test/tox.debian_11.ini | 8 ++++++++ 6 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 test/_debian_11.Dockerfile create mode 100644 test/tox.debian_11.ini diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d19df5ab..a6fd1acc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - distro: [debian_9, debian_10, ubuntu_16, ubuntu_18, ubuntu_20, centos_7, centos_8, fedora_32, fedora_33] + distro: [debian_9, debian_10, debian_11, ubuntu_16, ubuntu_18, ubuntu_20, centos_7, centos_8, fedora_32, fedora_33] env: DISTRO: ${{matrix.distro}} steps: diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index f0a22b6d..8ea640c2 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -410,12 +410,12 @@ os_check() { # This function gets a list of supported OS versions from a TXT record at versions.pi-hole.net # and determines whether or not the script is running on one of those systems local remote_os_domain valid_os valid_version detected_os detected_version cmdResult digReturnCode response - remote_os_domain="versions.pi-hole.net" + remote_os_domain=${OS_CHECK_DOMAIN_NAME:-"versions.pi-hole.net"} detected_os=$(grep "\bID\b" /etc/os-release | cut -d '=' -f2 | tr -d '"') detected_version=$(grep VERSION_ID /etc/os-release | cut -d '=' -f2 | tr -d '"') - cmdResult="$(dig +short -t txt ${remote_os_domain} @ns1.pi-hole.net 2>&1; echo $?)" + cmdResult="$(dig +short -t txt "${remote_os_domain}" @ns1.pi-hole.net 2>&1; echo $?)" #Get the return code of the previous command (last line) digReturnCode="${cmdResult##*$'\n'}" diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 96ca8c92..4212159e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -186,12 +186,12 @@ os_check() { # This function gets a list of supported OS versions from a TXT record at versions.pi-hole.net # and determines whether or not the script is running on one of those systems local remote_os_domain valid_os valid_version valid_response detected_os detected_version display_warning cmdResult digReturnCode response - remote_os_domain="versions.pi-hole.net" + remote_os_domain=${OS_CHECK_DOMAIN_NAME:-"versions.pi-hole.net"} detected_os=$(grep "\bID\b" /etc/os-release | cut -d '=' -f2 | tr -d '"') detected_version=$(grep VERSION_ID /etc/os-release | cut -d '=' -f2 | tr -d '"') - cmdResult="$(dig +short -t txt ${remote_os_domain} @ns1.pi-hole.net 2>&1; echo $?)" + cmdResult="$(dig +short -t txt "${remote_os_domain}" @ns1.pi-hole.net 2>&1; echo $?)" # Gets the return code of the previous command (last line) digReturnCode="${cmdResult##*$'\n'}" diff --git a/supportedos.txt b/supportedos.txt index 6d579132..c9332deb 100644 --- a/supportedos.txt +++ b/supportedos.txt @@ -1,5 +1,5 @@ Raspbian=9,10 Ubuntu=16,18,20 -Debian=9,10 +Debian=9,10,11 Fedora=32,33 -CentOS=7,8 \ No newline at end of file +CentOS=7,8 diff --git a/test/_debian_11.Dockerfile b/test/_debian_11.Dockerfile new file mode 100644 index 00000000..39be027e --- /dev/null +++ b/test/_debian_11.Dockerfile @@ -0,0 +1,17 @@ +FROM buildpack-deps:bullseye-scm + +ENV GITDIR /etc/.pihole +ENV SCRIPTDIR /opt/pihole + +RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole +ADD . $GITDIR +RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/ +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR + +RUN true && \ + chmod +x $SCRIPTDIR/* + +ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/tox.debian_11.ini b/test/tox.debian_11.ini new file mode 100644 index 00000000..af3c6e36 --- /dev/null +++ b/test/tox.debian_11.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py37 + +[testenv] +whitelist_externals = docker +deps = -rrequirements.txt +commands = docker build -f _debian_11.Dockerfile -t pytest_pihole:test_container ../ + pytest {posargs:-vv -n auto} ./test_automated_install.py From e2e7d0a6aa19e99cd0521a0644eae9f507739671 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 14 Jul 2021 22:36:02 +0100 Subject: [PATCH 2/4] add tests for ubuntu 21 Signed-off-by: Adam Warner --- test/_ubuntu_21.Dockerfile | 18 ++++++++++++++++++ test/tox.ubuntu_21.ini | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/_ubuntu_21.Dockerfile create mode 100644 test/tox.ubuntu_21.ini diff --git a/test/_ubuntu_21.Dockerfile b/test/_ubuntu_21.Dockerfile new file mode 100644 index 00000000..afddbfa9 --- /dev/null +++ b/test/_ubuntu_21.Dockerfile @@ -0,0 +1,18 @@ +FROM buildpack-deps:hirsute-scm + +ENV GITDIR /etc/.pihole +ENV SCRIPTDIR /opt/pihole + +RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole +ADD . $GITDIR +RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/ +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR +ENV DEBIAN_FRONTEND=noninteractive + +RUN true && \ + chmod +x $SCRIPTDIR/* + +ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/tox.ubuntu_21.ini b/test/tox.ubuntu_21.ini new file mode 100644 index 00000000..651f933b --- /dev/null +++ b/test/tox.ubuntu_21.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py37 + +[testenv] +whitelist_externals = docker +deps = -rrequirements.txt +commands = docker build -f _ubuntu_21.Dockerfile -t pytest_pihole:test_container ../ + pytest {posargs:-vv -n auto} ./test_automated_install.py From 38d4b2a88339fef06e88fbc2da65d5141ccf0feb Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 14 Jul 2021 22:41:17 +0100 Subject: [PATCH 3/4] add OS_CHECK_DOMAIN_NAME override to all the dockerfiles Signed-off-by: Adam Warner --- test/_centos_7.Dockerfile | 1 + test/_centos_8.Dockerfile | 1 + test/_debian_10.Dockerfile | 1 + test/_debian_9.Dockerfile | 1 + test/_fedora_32.Dockerfile | 1 + test/_fedora_33.Dockerfile | 1 + test/_ubuntu_16.Dockerfile | 1 + test/_ubuntu_18.Dockerfile | 1 + test/_ubuntu_20.Dockerfile | 1 + 9 files changed, 9 insertions(+) diff --git a/test/_centos_7.Dockerfile b/test/_centos_7.Dockerfile index 00543b67..434242bf 100644 --- a/test/_centos_7.Dockerfile +++ b/test/_centos_7.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_centos_8.Dockerfile b/test/_centos_8.Dockerfile index 7444551b..afd2dc8a 100644 --- a/test/_centos_8.Dockerfile +++ b/test/_centos_8.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_debian_10.Dockerfile b/test/_debian_10.Dockerfile index 9b72fc6a..54800d3c 100644 --- a/test/_debian_10.Dockerfile +++ b/test/_debian_10.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_debian_9.Dockerfile b/test/_debian_9.Dockerfile index d6609ba3..c590a657 100644 --- a/test/_debian_9.Dockerfile +++ b/test/_debian_9.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_fedora_32.Dockerfile b/test/_fedora_32.Dockerfile index 869efb2b..e9c2ff2a 100644 --- a/test/_fedora_32.Dockerfile +++ b/test/_fedora_32.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_fedora_33.Dockerfile b/test/_fedora_33.Dockerfile index 0a1ac59c..9ae94c70 100644 --- a/test/_fedora_33.Dockerfile +++ b/test/_fedora_33.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_ubuntu_16.Dockerfile b/test/_ubuntu_16.Dockerfile index a92bc6f6..e572efd1 100644 --- a/test/_ubuntu_16.Dockerfile +++ b/test/_ubuntu_16.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ \ No newline at end of file diff --git a/test/_ubuntu_18.Dockerfile b/test/_ubuntu_18.Dockerfile index 2f63ea89..592c5c3f 100644 --- a/test/_ubuntu_18.Dockerfile +++ b/test/_ubuntu_18.Dockerfile @@ -12,5 +12,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/_ubuntu_20.Dockerfile b/test/_ubuntu_20.Dockerfile index caa6261f..80e2e007 100644 --- a/test/_ubuntu_20.Dockerfile +++ b/test/_ubuntu_20.Dockerfile @@ -13,5 +13,6 @@ RUN true && \ chmod +x $SCRIPTDIR/* ENV PH_TEST true +ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net #sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ From a9b5fcd9230ff1f15ed85cfb92512c94d42e3301 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 15 Jul 2021 13:48:18 +0000 Subject: [PATCH 4/4] Add Ubuntu 21 to supportedos.txt, and github actions tests Signed-off-by: Daniel --- .github/workflows/test.yml | 2 +- supportedos.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6fd1acc..129caea4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - distro: [debian_9, debian_10, debian_11, ubuntu_16, ubuntu_18, ubuntu_20, centos_7, centos_8, fedora_32, fedora_33] + distro: [debian_9, debian_10, debian_11, ubuntu_16, ubuntu_18, ubuntu_20, ubuntu_21, centos_7, centos_8, fedora_32, fedora_33] env: DISTRO: ${{matrix.distro}} steps: diff --git a/supportedos.txt b/supportedos.txt index c9332deb..1726cc93 100644 --- a/supportedos.txt +++ b/supportedos.txt @@ -1,5 +1,5 @@ Raspbian=9,10 -Ubuntu=16,18,20 +Ubuntu=16,18,20,21 Debian=9,10,11 Fedora=32,33 CentOS=7,8