From 2aa539bbd63a4cc2e99774a2ab97022b653ecfb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 18 May 2020 13:22:26 +0200 Subject: [PATCH] Install Python test prerequisites in all images With the introduction of Python-based system tests in BIND, all operating system images used in GitLab CI should now have pytest and the "requests" module installed. Additionally, the pip tool should also be available to facilitate prototyping tests in merge requests by eliminating the need to install pip in each CI job. --- docker/bind9/alpine-template/Dockerfile | 2 ++ docker/bind9/centos-template/Dockerfile | 13 +++++++++++-- docker/bind9/debian-template/Dockerfile | 12 +++++++++--- docker/bind9/fedora-template/Dockerfile | 5 ++++- docker/bind9/tumbleweed-template/Dockerfile | 3 +++ packer/freebsd/post-install.sh.in | 2 +- packer/openbsd/post-install.sh | 2 +- 7 files changed, 31 insertions(+), 8 deletions(-) diff --git a/docker/bind9/alpine-template/Dockerfile b/docker/bind9/alpine-template/Dockerfile index 11f61eb..11f0249 100644 --- a/docker/bind9/alpine-template/Dockerfile +++ b/docker/bind9/alpine-template/Dockerfile @@ -32,6 +32,8 @@ RUN apk add \ perl-xml-simple \ py3-dnspython \ py3-ply \ + py3-pytest \ + py3-requests \ python3 \ tzdata RUN apk add \ diff --git a/docker/bind9/centos-template/Dockerfile b/docker/bind9/centos-template/Dockerfile index 6e9e59b..a322f54 100644 --- a/docker/bind9/centos-template/Dockerfile +++ b/docker/bind9/centos-template/Dockerfile @@ -39,20 +39,29 @@ RUN if [ "@VERSION@" = "centos8" ]; then yum -y install \ diffutils \ python3 \ python3-dns \ + python3-pip \ python3-ply \ + python3-pytest \ + python3-requests \ sqlite-devel \ ; fi RUN if [ "@VERSION@" = "centos7" ]; then yum -y install \ GeoIP-devel \ file \ libuv-devel \ - python-dns \ - python-ply \ + python36-dns \ + python36-pip \ + python36-ply \ + python36-pytest \ + python36-requests \ sqlite-devel \ ; fi RUN if [ "@VERSION@" = "centos6" ]; then yum -y install \ GeoIP-devel \ + python34-pip \ python34-ply \ + python34-pytest \ + python34-requests \ python34-setuptools \ ; fi RUN if [ "@DNSTAP@" = "yes" ]; then yum -y install fstrm-devel protobuf-c-devel; fi diff --git a/docker/bind9/debian-template/Dockerfile b/docker/bind9/debian-template/Dockerfile index 411a2b4..b5d6178 100644 --- a/docker/bind9/debian-template/Dockerfile +++ b/docker/bind9/debian-template/Dockerfile @@ -67,8 +67,11 @@ RUN apt-get -y install \ pkg-config \ procps \ python3 \ - python3-ply \ python3-dnspython \ + python3-pip \ + python3-ply \ + python3-pytest \ + python3-requests \ python3-sphinx \ python3-sphinx-rtd-theme \ sudo \ @@ -78,7 +81,10 @@ RUN apt-get -y install \ RUN if [ "@VERSION@" = "buster" ]; then apt-get -y install \ python \ python-dnspython \ + python-pip \ python-ply \ + python-pytest \ + python-requests \ ; fi RUN if [ "@ABI_CHECK@" = "yes" ]; then \ apt-get -y install abi-compliance-checker abi-dumper w3m; \ @@ -97,10 +103,10 @@ RUN if [ "@CLANG@" -ge "9" ] 2>/dev/null; then \ clang-tidy-@CLANG@; \ fi RUN if [ "@COCCINELLE@" = "yes" ]; then apt-get -y install coccinelle; fi -RUN if [ "@COMPILEDB@" = "yes" ]; then apt-get -y install python3-pip && pip3 install compiledb; fi +RUN if [ "@COMPILEDB@" = "yes" ]; then pip3 install compiledb; fi RUN if [ "@CPPCHECK@" = "yes" ]; then apt-get -y install cppcheck; fi RUN if [ "@DNSTAP@" = "yes" ]; then apt-get -y install libfstrm-dev libprotobuf-c-dev protobuf-c-compiler; fi -RUN if [ "@PYTHON_QA@" = "yes" ]; then apt-get -y install python3-pip && pip3 install flake8==3.8.1 pylint==2.5.2; fi +RUN if [ "@PYTHON_QA@" = "yes" ]; then pip3 install flake8==3.8.1 pylint==2.5.2; fi RUN if [ "@RESPDIFF@" = "yes" ]; then apt-get -y install python3-dpkt python3-lmdb python3-numpy python3-scipy python3-tabulate; fi RUN if [ "@SHELLCHECK@" = "yes" ]; then apt-get -y install shellcheck; fi RUN if [ "@SOFTHSM@" -ge "2" ] 2>/dev/null; then apt-get -y install libsofthsm2 softhsm2; fi diff --git a/docker/bind9/fedora-template/Dockerfile b/docker/bind9/fedora-template/Dockerfile index 1fdb7ad..0d8ac1d 100644 --- a/docker/bind9/fedora-template/Dockerfile +++ b/docker/bind9/fedora-template/Dockerfile @@ -32,7 +32,10 @@ RUN dnf -y install \ perl-XML-Simple \ procps-ng \ python-dns \ - python-ply + python-pip \ + python-ply \ + python-pytest \ + python-requests RUN if [ "@SOFTHSM@" -ge "2" ] 2>/dev/null; then dnf -y install softhsm; fi RUN dnf -y install \ gcc-c++ \ diff --git a/docker/bind9/tumbleweed-template/Dockerfile b/docker/bind9/tumbleweed-template/Dockerfile index 83171f9..154ea16 100644 --- a/docker/bind9/tumbleweed-template/Dockerfile +++ b/docker/bind9/tumbleweed-template/Dockerfile @@ -34,7 +34,10 @@ RUN zypper -n install \ perl-XML-Simple \ procps \ python3-dnspython \ + python3-pip \ python3-ply \ + python3-pytest \ + python3-requests \ sqlite3-devel \ system-user-nobody \ timezone diff --git a/packer/freebsd/post-install.sh.in b/packer/freebsd/post-install.sh.in index 581c827..d5aee26 100644 --- a/packer/freebsd/post-install.sh.in +++ b/packer/freebsd/post-install.sh.in @@ -6,7 +6,7 @@ echo "kern.corefile=core.%P" >> /etc/sysctl.conf sysrc hostname="freebsd" -ASSUME_ALWAYS_YES=yes pkg install bash cmocka fstrm gdb git json-c libmaxminddb libuv libxml2 p5-Net-DNS pkgconf protobuf-c py37-dnspython py37-ply sudo +ASSUME_ALWAYS_YES=yes pkg install bash cmocka fstrm gdb git json-c libmaxminddb libuv libxml2 p5-Net-DNS pkgconf protobuf-c py37-dnspython py37-pip py37-ply py37-pytest py37-requests sudo # Prefer GDB from ports if [ -x /usr/bin/gdb ]; then diff --git a/packer/openbsd/post-install.sh b/packer/openbsd/post-install.sh index 5272b84..cda9c7c 100644 --- a/packer/openbsd/post-install.sh +++ b/packer/openbsd/post-install.sh @@ -5,7 +5,7 @@ set -e -v echo "set timeout 1" >> /etc/boot.conf sed -i "s/rw/rw,softdep/" /etc/fstab -pkg_add bash cmocka git json-c libmaxminddb libuv libxml lmdb p5-Net-DNS py3-dnspython py3-ply sudo-- +pkg_add bash cmocka git json-c libmaxminddb libuv libxml lmdb p5-Net-DNS py3-dnspython py3-pip py3-ply py3-requests py3-test sudo-- echo "gitlab-runner ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers -- GitLab